[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shutdown computer after a specific command has been executed



Hi,

On Mon, Dec 09, 2013 at 02:38:45PM +0100, Ralf Mardorf wrote:

> One way would be to use a script that runs e.g. apt-get and then the
> shutdown command.
>
> #!/bin/sh
> apt-get update
> apt-get upgrade
> shutdown -h now # or poweroff or halt

> > >> If you want it shut down regardless of the outcome of apt, then this
> > >> should do it:
> > >>
> > >>         sudo apt-get upgrade; sudo shutdown -h now
> > > 
> > > Wrong, if the upgrade should take to long, then you need to type the
> > > password after the upgrade. Better run
> > > 
> > > $ sudo -i
> > > # apt-get update ; apt-get upgrade ; shutdown -h now

I think Ralf is right on everything he mentioned.

But I want one line solution :-)

 sudo sh -c "apt-get update && apt-get upgrade; shutdown -h now"

Osamu


Reply to: