Tech Support > Microsoft Windows > Windows Server > stop and start a service automaticly
stop and start a service automaticly
Posted by Stijn on April 4th, 2007


hello,

I have a service wich has sometimes a leak, so to prevent it to make the
server slow I would like to stop and start the service every 2 nights
automaticly.
How can I do this?
Thanks in advance.

Posted by Nick Domukhovsky on April 4th, 2007


Make a job for the script

sc stop <service name>
sc start <service name>


--
With best regards
Nickolay Domukhovsky, MCSA

Posted by Pegasus \(MVP\) on April 4th, 2007



"Stijn" <Stijn@discussions.microsoft.com> wrote in message
news:9CF5868E-A9CB-40E4-A015-C3F8EAC4D9D1@microsoft.com...
Use the Task Scheduler to schedule this batch file:
@echo off
net stop "Some Task"
net start "Some Task"



Posted by Lars Petersson on April 4th, 2007


The easiest would probably be to write a simple batch file with the commands:
NET STOP <name_of_service>
NET START <name_of_service>

And then create a scheduled task to activate every other night.
--
Cheerio,
Lars Petersson
MCSA: Messaging
mr-eleganza.livejournal.com


"Stijn" wrote:

Posted by leew [MVP] on April 4th, 2007


Stijn wrote:
Make a batch file (.cmd or .bat extension) and schedule it to run every
other day at a given time in the scheduled tasks control panel. The
batch file should consist of the following two lines.

NET STOP SERVICENAME
NET START SERVICENAME

Posted by Stijn on April 5th, 2007


Thanks to you all.
Stijn

"leew [MVP]" wrote:


Similar Posts