Some time we need shutdown process be automatically and our computer Shutdown automatically on particular time, this can be possible with Job scheduling
In Linux For Job Scheduling 2 utility available one is "at" and second is "cron"
at- Execute a task at a specific time. and "at" is Useful only to schedule one job at a time or a single future event. in this we can not define recurring events or daily events.
for shutting down Linux automatically at 11:59 pm, use following example.
# at 11:59pm
Some more command for "at"
- atq - List the current "at" jobs pending.
- atrm - Used to remove pending "at" jobs.
Linux Cron job to Shutdown Linux server/Desktop system:
cron – cron is Linux command line task scheduler, Useful to schedule recurring events or daily events such as backup, check system security etc.
Step 1 - Login as root user and at shell prompt type crontab -e command so that you can add cronjob.
|# crontab -e|
Step 2 - above command open root users crontab file in vim editor and then Append following entry to it (shutdown at 23:59 hrs (24 hrs format).
59 23 * * * /sbin/shutdown -h now
(3) Save the changes and exit from vim editor to shell prompt.