Posted: Sat Sep 05, 2009 21:26 Post subject: Shutdown computers? [SOLVED]
Had some time today to play around with WOL and using it with cron. I can wake up a couple of pcs that I want to backup at midnight and now I would like to know if it is possible to shut them down at a certain time, kind of the reverse of WOL?
What OS are running on these machines? Could always make a script, using ssh commands to connect and poweroff *nix PC's. _________________ Ps = (1.5 x 6 x .75) / {(4/3) (pi) [(31.039 x 10^15) (46.5 x 10^9)]^3}
Seems like a waste..
Posted: Sat Sep 05, 2009 23:28 Post subject: Re: Shutdown computers?
GeeTek wrote:
Windows XP
shutdown -s -f
shutdown /? for more options.
They are XP machines but I am not awake when these machines are backing up. The cron job I run wakes them up at midnight for backing up to a server, the server will back them up at some random time between midnight and 6 am. What I am looking for is a script (or something) that will shut them down at let's say 6:15 am.
@the.root:
Can you give me some examples of SSH commands that might work? I am not well versed in that but could learn!
Joined: 06 Jun 2006 Posts: 3763 Location: I'm the one on the plate.
Posted: Sat Sep 05, 2009 23:52 Post subject: Re: Shutdown computers?
Slione wrote:
What I am looking for is a script (or something) that will shut them down at let's say 6:15 am.
shutdown -s -f
Save that one line as a batch file. To do this you can copy and paste that line into notepad and save it as a text file. Then change the file extension from .txt to .bat to make it an executable batch file. The use Windows Scheduled Tasks in the control panel to run the batch file at 6:15 AM. _________________ http://69.175.13.131:8015 Streaming Week-End Disco. Station Ripper V 1.1 will do.
Joined: 22 Jun 2008 Posts: 2440 Location: Am now Dark_Shadow
Posted: Sun Sep 06, 2009 0:29 Post subject: Re: Shutdown computers?
Slione wrote:
GeeTek wrote:
Windows XP
shutdown -s -f
shutdown /? for more options.
They are XP machines but I am not awake when these machines are backing up. The cron job I run wakes them up at midnight for backing up to a server, the server will back them up at some random time between midnight and 6 am. What I am looking for is a script (or something) that will shut them down at let's say 6:15 am.
@the.root:
Can you give me some examples of SSH commands that might work? I am not well versed in that but could learn!
Thanks.
Do you want to "Shut them down" or "Put them back to sleep"? _________________ The New Me
Posted: Sun Sep 06, 2009 0:41 Post subject: Re: Shutdown computers?
GeeTek wrote:
shutdown -s -f
Save that one line as a batch file. To do this you can copy and paste that line into notepad and save it as a text file. Then change the file extension from .txt to .bat to make it an executable batch file. The use Windows Scheduled Tasks in the control panel to run the batch file at 6:15 AM.
Thanks GeeTek I'll give that a shot!
@DHC_DarkShadow:
For now I need these computers to be shut down....I never really thought about putting them to sleep....hmmmm something else to ponder. _________________ WRT1900AC v1-build r30731
Joined: 22 Jun 2008 Posts: 2440 Location: Am now Dark_Shadow
Posted: Sun Sep 06, 2009 0:57 Post subject: Re: Shutdown computers?
Slione wrote:
GeeTek wrote:
shutdown -s -f
Save that one line as a batch file. To do this you can copy and paste that line into notepad and save it as a text file. Then change the file extension from .txt to .bat to make it an executable batch file. The use Windows Scheduled Tasks in the control panel to run the batch file at 6:15 AM.
Thanks GeeTek I'll give that a shot!
@DHC_DarkShadow:
For now I need these computers to be shut down....I never really thought about putting them to sleep....hmmmm something else to ponder.
If you shut them down, will somebody restart them? I am concerned for the backup the next night. Not sure if these are used computers or not, but if you just want them back asleep there is nothing else to do, they will sleep on there own. _________________ The New Me
Posted: Sun Sep 06, 2009 2:07 Post subject: Re: Shutdown computers?
DHC_DarkShadow wrote:
If you shut them down, will somebody restart them? I am concerned for the backup the next night. Not sure if these are used computers or not, but if you just want them back asleep there is nothing else to do, they will sleep on there own.
Actually they will be re-awakened the next day with the cron job I put in the router:
How exactly are you backing up your PC? Is it a software on your PC that runs once you WOL it from your router?
It's actually a Windows Home Server (WHS) that does the backing up. The pcs just need to be on and the WHS does the backups between midnight and 6 am. _________________ WRT1900AC v1-build r30731
Posted: Sun Sep 06, 2009 12:40 Post subject: Re: Shutdown computers?
GeeTek wrote:
shutdown -s -f
Save that one line as a batch file. To do this you can copy and paste that line into notepad and save it as a text file. Then change the file extension from .txt to .bat to make it an executable batch file. The use Windows Scheduled Tasks in the control panel to run the batch file at 6:15 AM.
I setup the batch file with this command, setup the Windows Scheduled task and when the time hit all that happened was a Command window opened up and the shutdown -s -f command was scrolling. I thought it might have been a problem with me being logged in remotely so I reset the time for the scheduled task to run again and made sure I was not logged on remotely and it still did not shut it down.
I don't know if this will help but when the machine gets woken up it just sits at the signon screen. Is this method supposed to work from just the signon screen? _________________ WRT1900AC v1-build r30731
This might be a cool post to add to the Wiki for the different operating systems to do these WOL and SOL (Sleep on Lan ) functions. _________________
ASUS AC3200
Linksys WRT32X
Linksys WRT3200 ACM
How exactly are you backing up your PC? Is it a software on your PC that runs once you WOL it from your router?
It's actually a Windows Home Server (WHS) that does the backing up. The pcs just need to be on and the WHS does the backups between midnight and 6 am.
I don't have DD-WRT running on any of my routers now so I can't test but there's a nifty little utility in the samba package that let's you shutdown a windows machine remotely:
net rpc shutdown -I ipAddressOfWindowsPC -U username%password
This will issue a shutdown command to the Windows machine. username must be an administrator on the Windows machine. Other relevant commands are:
net rpc shutdown -r : reboot the Windows machine
net rpc abortshutdown : abort shutdown of the Windows machine
I use WOL and net rpc extensively on my network to wake up, backup and shutdown the computers on my network one by one. Hope this helps, cheers! _________________