Re: How do I run a batch file when a server reboots?
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Wed, 6 Aug 2008 21:46:06 +0200
"Marten" <absolute88@xxxxxxxxxxx> wrote in message
news:hkrj94db3cp6bv3m4clcvrneifcur8c8fa@xxxxxxxxxx
On Wed, 6 Aug 2008 19:54:47 +0200, "Pegasus \(MVP\)"
<I.can@xxxxxxxxxx> wrote:
It seems you don't want to leave the mark for the ***boot-up***
event but rather for the ***shut-down*** event. Use the Task
Scheduler to invoke a batch file with two commands inside:
- Your "echo" command (probably supplemented with %date%
and %time%)
- shutdown.exe
You should also use the >> redirector so that subsequent
shutdown events do not overwrite the previous ones.
That's a good method, thank you. I forgot to think of calling a batch
file from the scheduler.
My only concern is getting a false positive. By that I mean the first
line (per your suggestion) runs and creates the mark file, but for
what ever reason the Shutdown fails and the server doesn't reboot.
Which has happened. My thinking was if I could put the call to my
batch file in some equivalent of AUTOEXEC.BAT, I could be sure it was
processed during the power up.
The >> redirector is a consideration. I'm mostly concerned with thee
last reboot. But having a bit of history isn't bad. As long as I
remember to trim the file periodically.
for the record, the Shutdown command used is:
C:\WINDOWS\system32\shutdown.exe /r /d p:4:1
Marten
I'm quite aware of the syntax for the shutdown command . . .
Running a command at boot time (the equivalent of Autoexec.bat)
is dead easy: Use the Task Scheduler to run it at boot time.
However - how will you distinguish between a boot after a
scheduled shutdown and a boot caused by a crash?
About trimming the log file: If you schedule a reboot once every
week then you accumulate some 2 kBytes per annum. I would
not call this a huge amount of disk space - it's puny, so why worry?
.
- Follow-Ups:
- Re: How do I run a batch file when a server reboots?
- From: Marten
- Re: How do I run a batch file when a server reboots?
- References:
- How do I run a batch file when a server reboots?
- From: Marten
- Re: How do I run a batch file when a server reboots?
- From: Pegasus \(MVP\)
- Re: How do I run a batch file when a server reboots?
- From: Marten
- How do I run a batch file when a server reboots?
- Prev by Date: Re: How do I run a batch file when a server reboots?
- Next by Date: Re: How do I run a batch file when a server reboots?
- Previous by thread: Re: How do I run a batch file when a server reboots?
- Next by thread: Re: How do I run a batch file when a server reboots?
- Index(es):
Relevant Pages
|