This post describes steps you can take to schedule a task to automatically shutdown Ubuntu Linux at specific time.
If you want to have your computer automatically shutdown at a given time, Ubuntu Linux allows you to create a task and schedule it to shutdown your computer.
Many of the administrative tasks in Ubuntu Linux run via the command line console. You’ll need to get familiar with the command console when using Ubuntu Linux.
To learn more about Cron, please read the post below:
For a user who forgets to shutdown daily and but want to schedule a task to automatically shutdown their Ubuntu Linux at a specific time so that it doesn’t stay on all day using energy, the steps below could be useful.
We’ll show you how to use Cron to schedule a job to shutdown your Ubuntu Linux computer at specific time.
How to automatically turn off Ubuntu Linux
As mentioned above, keeping your computer on forever may not be a good thing for your energy bills. In Ubuntu Linux, you can schedule a job to shutdown your computer daily at specific time.
To do that, you’ll need to read two posts:
After reading the post above, you should have a good idea on how Cron works and how to shutdown Ubuntu Linux.
For example, if you want to shutdown your Ubuntu Linux computer every at 6:30 PM, you’ll edit crontab and add the shutdown command and specify the date and time.
Run the commands below to edit crontab.
sudo crontab -e
When you run crontab -e for the first time, you may get a prompt screen to choose an editor.
no crontab for root - using an empty one Select an editor. To change later, run 'select-editor'. 1. /bin/nano <---- easiest 2. /usr/bin/vim.tiny 3. /bin/ed Choose 1-3 : 1
Then add the command on a new line below to shutdown daily at 6:30 PM.
30 18 * * * shutdown now
Press CTRL + X to exit, then press Enter to save your changes and you’re done.
If you want to restart Ubuntu Linux instead, you’ll use -r.
shutdown -r now
Again, using the post above about Cron, you can specify different day, dates, time and other variables in Cron.
That should do it!
This post showed you how to schedule a task in Ubuntu Linux to automatically shutdown the computer at specific time. If you find any error above or have something to share, please use the comment form below to report.