How to shut down the computer after a task has been completed?
Solution 1:
I know that this does not exactly answer your question but you can also make it time based i.e if you think that your download will complete in 2 hours you can simply issue command:
shutdown -h +120
Solution 2:
To do once to enable you to shut down the machine without a password:
Open a command line and type:
sudo visudo
In the File that opens add the following line at the end:
yourusername ALL=NOPASSWD: /sbin/halt
Then exit the editor and safe it (Ctrl+X).
Now you can shut down your computer from the command line, e.g. after you download something:
wget UrlOfTheFileYouWantToDownload && sudo halt
Solution 3:
To shutdown after update you may use this python script: http://kotbcorp.blogspot.com/2009/06/shutdown-after-update-in-ubuntu.html
To shutdown after download i use this command:
wget http://somehwere.com/path/to/some.file && halt
Solution 4:
Other answers are correct, but missing something:
wget UrlOfTheFileYouWantToDownload ; sudo halt
vs
wget UrlOfTheFileYouWantToDownload && sudo halt
The second one will only shut down the computer if wget
returns successfully. The first one will run halt whether wget
returns successfully or fails.
Solution 5:
you can use the download managers or torrent clients to shut down the pc after done or suppose you are defragmenting the disk you can click on shut down after done which is available in most softwares