LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to turn off the system automatically ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-turn-off-the-system-automatically-868411/)

gardenair 03-14-2011 01:10 AM

How to turn off the system automatically ?
 
Hi,
I am using Cent Os 5. I want that the system should shutdown automatically at 7:00 pm daily and next day I manually turn on the system.I have google it but the syntax is not clear.

I use # crontab -e
and write the command
0 19 * * * /sbin/shutdown -h now


I does't apply the command but please guide me that what is * * * after 19
Kindly guide me how can I enable this feature?
thanks in advance,
garden

vishnu_sreekumar 03-14-2011 01:30 AM

Scheduling a "shutdown -h now" via a cron job (for root user) that runs at 7.00 PM daily would do that.

Edit the crontab and add the following line
# crontab -e
Code:

  0 19 * * * /sbin/shutdown -h now
Check the man page for crontab (5) for more details.

gardenair 03-14-2011 01:36 AM

thanks "vishnu_sreekumar" for the reply. Well what does * * * means ?
If I want to do it at 7:15 PM then how will it write ?
thanks for guiding me
garden

yooy 03-14-2011 02:30 AM

Quote:

If I want to do it at 7:15 PM then how will it write ?
15 19 * * * /sbin/shutdown -h now

repo 03-14-2011 02:42 AM

I would suggest to take a look at
http://en.wikipedia.org/wiki/Cron

Kind regards

vishnu_sreekumar 03-21-2011 01:07 AM

Quote:

Originally Posted by gardenair (Post 4289917)
thanks "vishnu_sreekumar" for the reply. Well what does * * * means ?
If I want to do it at 7:15 PM then how will it write ?
thanks for guiding me
garden

Assume that you went through the wiki page and found the answer :)


All times are GMT -5. The time now is 06:29 PM.