Auto Shutdown, Reboot, Suspend, Hibernate Your Linux System At A Specific Time
Method 1 – Using Autopoweroff
Autopoweroff is simple, yet useful utility that can be used to poweroff, reboot, suspend, hibernate your system, or run any custom command provided by the user at a specific time. On good thing about Autopoweroff is it will shutdown the system only when certain conditions are met. If the system we intended to shutdown is being accessed/used by another system, it won’t shutdown. Let us say you have set shutdown time at 12:00am, but some other systems on your network are still accessing it after 12:00am, then it will not shutdown. It will wait for the other systems to complete their work, and shutdown itself only if no other computer on the network is responding to ping. Sounds pretty good, isn’t it?
Your system will shutdown, suspend, or hibernate when the following conditions are met:
- Any hosts that the computer is dependant on is not answering ping anymore.
- No keyboard or mouse activity has been detected on the computer for a while.
- The user has not disabled Autopoweroff.
Autompoweroff should work on any modern Linux operating systems, and is free and open source. So, anyone can fork, improve the code, or add any additional features they want.
Download the latest Autopoweroff installer file for your distribution. Currently, .deb, and .rpm packages are available.
As I use Ubuntu, I downloaded the .deb file.
Then, install it using commands:
Configuration
Once installed, open GUI configuration tool or /etc/autopoweroff.conf file and edit to your particular needs.
Here, let us follow the GUI method. Open up Autopoweroff GUI configuration tool either from the the Menu or Unity dash.
This is how Autopoweroff configuration window looks like.
As you can see in the above screenshot, Autopoweroff utility has two sections namely Status & Commands, and Configuration. In Status & Commands section, you can enable or disable the options such as auto shutdown, suspend, reboot, and hibernate.
In Configuration section, you can set the time to run a particular action at a specific time.
The configuration section has further split into three columns. In the first column, you can define the period and timeouts settings.
- Start hour – Start hour of the ‘no action’ interval. Autopoweroff will run the action such as poweroff, suspend, reboot, hibernate or other only outside the (Start hour, End hour) interval.
- End hour – End hour of the ‘no action’ interval. Autopoweroff will run the action such as poweroff, suspend, reboot, hibernate or other only outside the (Start hour, End hour) interval.
- Idle time – It is the time required by Autopoweroff to wait for idle user interactively (keyboard, mouse, joystick… etc) before proceeding to any action. Thus if Autopoweroff finds itself outside the ‘no action’ interval, the action would still not be executed as long as there is user activity on the computer + ‘idle time’ delay.
- Boot delay – It is the minimum delay that Autopoweroff must wait before running any action if Autopoweroff was started during a shutdown interval. This prevents accidental shutdown to occur if Autopoweroff was unexpectedly started; it gives time for users to kill Autopoweroff.
In second column, you can add, remove, or edit dependant systems with their hostname or ip address. In third column, you can select the actions that needs to be performed at a specific time. Your system will poweroff, sleep, hibernate, or execute any custom command based on the inputs you’ve given in the Configuration section. You need to be careful in this section. Any misconfigured settings will cost you data loss or unwanted/unexpected shutdown or reboot.
Once you made the changes, click Save to apply the changes. You can undo the changes by clicking the Revert button. To close this utility, simply press Quit button.
For more details, refer Autopoweroff GitHub page.
Method 2 – Using qshutdown
qshutdown is yet another useful utility to auto shutdown, reboot, suspend, and hibernate your system at a specific time. It works well on Ubuntu, Linux Mint and other Ubuntu variants such as Kubuntu, Xubuntu, Lubuntu, etc.
To install it on Ubuntu and its derivatives, run the following commands one bey one in your Terminal:
Once installed, launch it either from Unity dash or Menu.
This is how qshutdown interface looks like in my Ubuntu 16.04 LTS desktop.
As you can see in the above screenhsot, qshutdown hasn’t much options. There are only few settings. If you want to perform any action (shutdown/reboot/suspend/hibernate) in your system in 60 minutes from now, just choose “Minutes till shutdown” option and enter the time. Then, click OK.
Once you hit the OK button, the countdown time will start, and the selected action will be performed at the exact time.
If you want to show the warnings before the selected action takes place, check the box that says “Warnings on”.
To schedule your action at a specific time, choose “Shutdown-time” and enter the exact time to perform the selected action.
As you see in above screenshot, I want my system to shutdown itself at 4:40pm. You are free to choose any other action of your liking.
Another good thing is we can schedule the actions weekly. To do so, click Calendar, and go to Weekly option. There you can choose action you want to perform on a specific day of the week.
qshutdown is very simple, yet fully functional and useful utility. Unlike Autopoweroff, qshutdown will shutdown, suspend, hibernate your system as soon as it reached the deadline, even if one of your other systems are accessing it. So, you must be very very careful while doing any remote jobs.
For more details, refer qshutdown launchpad page.
And, that’s all. Hope these two utilities helps you in one way or another. These kind of utilities will quite be useful for those who want to work with the computer only for a certain time.
No comments:
Post a Comment