We help IT Professionals succeed at work.

What is the best way to restart server at midnight ?

shouichi
shouichi asked
on
What is the best way to restart server at midnight everyday ?

script,
bat,
Scheduled task..

whatever is OK .
Please let me know the easiest and professional way.
Comment
Watch Question

Kent WSr. Network / Systems Admin

Commented:
If it's windows, you can script the shutdown command

from remote with admin credentials -

shutdown \\computername /r

locally

shutdown /l /a /y

use scheduler to run the command or batch file containing the command
Top Expert 2012

Commented:
What is really fine just to restart a server but now it might not be ok depending on the servers' applications
I do this for a few servers. I create a batch file called reboot.cmd and it contains the following:-

shutdown /r /f /t 300

/r - restarts (/s would shutdown)
/f - forces all applications to quit
/t 300 - wait 300 seconds before restarting

THEN I use Task Scheduler to run the reboot.cmd file at a specified time each day.
Kent WSr. Network / Systems Admin

Commented:
Ohhh...K...
Guess my version was harder to read or something? ;)
@mugojava - I think your (local) switches are from a 2000/NT version of shutdown - PLUS the /a aborts the shutdown, and the /l /y doesn't restart the server, it simply logs the user off...