Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
The python script you refer to seems fairly harmless. –  don.joey Jun 6 '13 at 8:42
    
Also check: askubuntu.com/questions/15526/… –  don.joey Jun 6 '13 at 8:45
    
ALL=NOPASSWD is not going well with me :D –  22lk94k943 only Jun 6 '13 at 11:37
    
also it's not really recommended...there's a reason you need your password for some tasks ;) –  Daniel Jun 6 '13 at 13:09
add comment

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
Thanks @Daniel but the weird thing i have seen in updating through terminal is it leaves few updates without installing them. And why dist-upgrade? –  22lk94k943 only Jun 6 '13 at 11:36
    
apt-get upgrade sometimes leaves out some upgrades, notably kernel upgrades. apt-get dist-upgrade will however upgrade the kernel, and could remove some packages that upgrade would usually not. Visit man apt-get for more info, or this question. –  Alaa Ali Jun 6 '13 at 11:50
    
like Alaa said 'apt-get dist-upgrade' upgrades all the packages that would be held back by 'apt-get update' –  Daniel Jun 6 '13 at 13:08
    
Won't it upgrade to the latest ubuntu release available at time. –  22lk94k943 only Jun 6 '13 at 13:58
    
No it will not do that. update only updates packages to their new versions. dist-upgrade is able to also install new dependencies and uninstall obsolete ones. So update will hold back any update that would require to install new dependencies –  Daniel Jun 6 '13 at 15:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.