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

Re: Shutdown computer after a specific command has been executed



On Thu, 12 Dec 2013 16:10:44 +0100
Ralf Mardorf <ralf.mardorf@alice-dsl.net> wrote:

> On Thu, 2013-12-12 at 18:57 +0400, Reco wrote:
> > sudo sh -c "apt-get update && apt-get upgrade -y && poweroff"
> > 
> > That's more like it. Depending on a hardware, 'shutdown -h now' can
> > leave the power on.
> 
> :D We are close to solve it :D.
> 
> && apt-get upgrade -y && poweroff
>                       ^^^^ if the upgrade fails, it won't shutdown, then
> it won't go off-line and be a big issue for the OP.

That's intentional. Failed upgrade needs human intervention, and that
trick is hard to accomplish if the box goes down.

Still, if one has desire to blow legs off:

sudo sh -c "apt-get update && apt-get upgrade -y ; poweroff"

Reco


Reply to: