Computing.Net > Forums > Database > Sql query to stop a service

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Sql query to stop a service

Reply to Message Icon

Name: mitchell311
Date: January 13, 2009 at 06:20:32 Pacific
OS: Windows 2003
CPU/Ram: xeon, 4 gigs
Product: Dell / 2950
Subcategory: MS SQL Server
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: michalakr
Date: January 26, 2009 at 12:01:29 Pacific
Reply:

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


0
Reply to Message Icon

Related Posts

See More


formula in Crystal Report... images to database



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Database Forum Home


Sponsored links

Ads by Google


Results for: Sql query to stop a service

Need SQL Query www.computing.net/answers/dbase/need-sql-query/366.html

Need help with SQL-query (access) www.computing.net/answers/dbase/need-help-with-sqlquery-access/209.html

SQL Query Help www.computing.net/answers/dbase/sql-query-help/653.html