How to shut down the computer after a task has been completed

command lineshutdown

I usually start a download before I go to school.
Which command should I use to automatically make the necessary saves and turn off the computer after a particular task has been completed?
(Say, after installing the updates, or after downloading a large file.)

I have also cross-posted at askubuntu.

Best Answer

It depends you started task. If it is some command line tool you could simply run halt or shutdown -h now:

  1. wget http://..../somelargefile; halt - halt will be executed after wget

  2. wget http://..../somelargefile && halt - halt will be executed if wget return no errors

  3. wget http://..../somelargefile || halt - halt will be executed if wget return errors

Alternative to this is using kshutdown - in this app you can specify what action should be done (reboot/shutdown/hibernate/etc or command execution) and when (after some time or when another application exits). If you want to use this tool you need to chose correct process - some update utilities starts few subprocesses.

KShutdown

Related Question