Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automatic shutdown/boot of linux box

Status
Not open for further replies.

room24

Programmer
Dec 28, 2003
83
JM
is there a way to use cron job etc to autmatically shutdown my linux box say 7pm every evening and then boot it autmatically 8am every morning??
 
do you need the command?

shutdown -g0 -y -i0


-g0 : wait 0 secons
-y : answer yes to all questions
-i0 : init 0


man shutdown
cheers.

 
The shutdown can be accomplished, as Chacalinc says, through the use of the [tt]shutdown[/tt] command.

However, once the machine is shut down, cron won't be running so it can't restart the machine. If your machine can be configured to boot at poweron, you might look at some kind of power outlet timer. Have it shut off power at 7:30 pm (to make sure cron has had time to do what it needs) and then power up the machine the next morning.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
You can cron to shutoff the NIC using ifdn and then ifup at the desired time. This has the effect of making the box inaccessible to all users but those at the local console. If someone has local console, they can power it up any time they like anyways.

BTW, RedHat uses "shutdown -h now" to shutdown for a halt and "now". A variant on a theme.

 
ok i can use a cron job with 'shutdown -h now' command but i am not too keen on how to make the box power up at a specified time by itself
 
You CAN'T tell a powered off box to do anything!!!! It's not on.

Thus the point I made about turning off the NIC. Just make it look like it's down unless you don't want local console access.


 
You could shut the box down with 'shutdown' set the BIOS to start on power restore and use a powerline timer to turn the power back on in the morning.
 
Depending on the system the BIOS may have a 'wake on alarm' or similar setting that can be used to turn the machine on at a specified time.
 
My bios shows an option 'power on lan', so you could wake it up from a different machine via the lan perhaps - but I didn't try it.

Together with acpi or apm, couldn't you suspend to ram for a specified time? Didn't try this too...

seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top