Sql query to stop a service

Dell / 2950
January 13, 2009 at 06:20:32
Specs: Windows 2003, xeon, 4 gigs
I have a sql database that I need to monitor with nagios but it will not work with sql 2005. I was wondering if a sql query that can watch the database and if data has not been written to the main table for more then 15-30 minutes that it can then stop a dummy Windows Service. Then I can have nagios watch if the service is up or down? Thanks

See More: Sql query to stop a service

Report •

January 26, 2009 at 12:01:29
You could. depending on the release of software you are running, you could experience configuration issues.

SQL 2005 requires you to enable the xp_cmdShell (google: SQL 2005 enable xp_cmdShell)

using sql 2000 or sql 2005 you can run a command like this to turn off w32Time

declare @CmdLine varchar(1024)
declare @Command varchar(100)
declare @RetInfo varchar(8000)

select @Command = 'net stop W32Time'

print @Command
exec @RetInfo = master.dbo.xp_cmdshell @Command

print @RetInfo

Report •
Related Solutions

Ask Question