9

Using a EDGE for update is really not cool but i have to. So my update always runs in night when i go to sleep.

Is there any way to set ubuntu to auto-shutdown after completion of update.

Note: I saw a link in a similar post that redirects to a python script(SEE HERE) but i am not well acquainted with these kind of scripts.

Any help would be appreciated.

1 Answers1

16

Technically you could do everything in the shell.

Just type

sudo -i
apt-get update && apt-get -y dist-upgrade && shutdown -P now

sudo -i makes you root till you manually log out of it by using exit this is just to make sure that your sudo rights don't time-out if the update takes too long (usually sudo rights time out after 15 minutes if I remember correctly).
The && operator concatenates the commands. Basically you can read it as:
If command 1 finished succesfully execute command 2, if command 2 finished succesfully execute command 3
and so on...Note: The other commands will only run if the command before it finished succesfully.

The -y parameter after apt-get answers all prompted questions with 'yes'.
The shutdown -P now shuts your computer down for power-off(-P) immediately (now).
To get an overview what other parameters there are for shutdown run shutdown --help

Daniel W.
  • 3,496