I found out that having an option to Shutdown Ubuntu with timer is one of the DAILY commands that I actually use in Ubuntu. I found this one particularly useful!
Schedule a Ubuntu shutdown in 35 minutes
//shutdown Ubuntu in 35 minutes. In my opinion, this is the BEST method for scheduling a shutdown in Ubuntu.
sudo shutdown -P +35
This is a way of telling computer, hey, (shutdown)power off in 40 minutes.
Schedule a Ubuntu shutdown at a specific time.
sudo shutdown -P 1:00
//Hey Linux, shutdown at 1 AM.
sudo shutdown -P now // shutdown Ubuntu now.sudo sudo shutdown -H now // shutdown Ubuntu now.
sudo shutdown hh:mm
sudo shutdown 7:50
Shouting down a system at a certain time can be very useful.
For example, you need to shutdown Ubuntu after going to sleep, and you can aproximate that you would need x minutes to shutdown your Ubuntu system.
In order to do that, you could use:
Use EasyShutdown to Shutdown Ubuntu with timer for Ubuntu – GUI
After, starting a shutdown, if the time argument is not “+0” or “now”, you can use:
sudo shutdown -c
Explanation of Shutdown Flags for Ubuntu
The Shutdown flags are useful for providing some options for shutting-down Ubuntu. I’ve extracted this from the command manual:NAMEshutdown – Halt, power-off or reboot the machineDESCRIPTIONshutdown may be used to halt, power-off or reboot the machine.The first argument may be a time string (which is usually “now”). Optionally, this may be followed by a wall message to be sent to all logged-in users before going down.The time string may either be in the format “hh:mm” for hour/minutes specifying the time to execute the shutdown at, specified in 24h clock format. Alternatively it may be in the syntax “+m” referring to thespecified number of minutes m from now. “now” is an alias for “+0”, i.e. for triggering an immediate shutdown. If no time argument is specified, “+1” is implied.Note that to specify a wall message you must specify a time argument, too.If the time argument is used, 5 minutes before the system goes down the /run/nologin file is created to ensure that further logins shall not be allowed.
-r Requests that the system be rebooted after it has been brought down.
-h Requests that the system be either halted or powered off after it has been brought down, with the choice as to
which left up to the system.
-H Requests that the system be halted after it has been brought down.
-P Requests that the system be powered off after it has been brought down.
-c Cancels a running shutdown. TIME is not specified with this option, the first argument is MESSAGE.
-k Only send out the warning messages and disable logins, do not actually bring the system down
You can have a question or you have something to say, get in touch with me, here: https://sdet.ro/contact