In this post we can see how to shutdown the system automatically, ie daily at particular time or once in a week days or once in a month. To shutdown the system follow the steps given below.
1. First need to install a package. The package can installed by using terminal.sudo apt-get install cron
2. Open text editor and write the script as given below,
Shutdown Daily
To shutdown the system daily, copy and past the script in text editor and save file name as root in the directory given below./var/spool/cron/crontabs/filename
# minutes hrs, dayofmonth, month, dayofweek command
55 13 * * * /sbin/shutdown -h now
The above code will shutdown the system daily at 1:00 Pm.
Shutdown Weekly once
To shutdown the system once in a week, copy and past the script in text editor and save file name as root in the directory given above.
# minutes hrs, dayofmonth, month, dayofweek command
00 13 * * 0 /sbin/shutdown -h now
The machine will shutdown every Sunday 1:00 Pm.
Same as Sunday we can shutdown the machine Monday, Tuesday, Wednesday,Thursday,Friday,Saturday and Sunday. For this change the value from 0 to 6 for this in the same script.
00 13 * * 0 /sbin/shutdown -h now #shutdown Sunday at 1:00 Pm
55 8 * * 1 /sbin/shutdown -h now #shutdown Monday at 8:55 Am
55 3 * * 2 /sbin/shutdown -h now #shutdown Tuesday at 3:55 Am
55 3 * * 3 /sbin/shutdown -h now #shutdown Wednesday at 3:55 Am
55 6 * * 4 /sbin/shutdown -h now #shutdown Thursday at 6:55 Am
55 4 * * 5 /sbin/shutdown -h now #shutdown Friday at 4:55 Am
55 2 * * 6 /sbin/shutdown -h now #shutdown Saturday at 2:55 Am
the value range from 0 - 6,
0 -----> Sunday
1 -----> Monday
2 -----> Tuesday
3 -----> Wednesday
4 -----> Thursday
5 -----> Friday
6 -----> Saturday
Note :
1. The file name must named as root.
2. Save the root file in the directory given below/var/spool/cron/crontabs/
Post a Comment