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

Re: script to do nightly dist-upgrade



On Tue, 2002-07-30 at 17:25, Paul Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Tue, Jul 30, 2002 at 10:17:50AM +0100, Ben Thompson wrote:
> > The trouble is: sometimes my internet connection times out and apt-get exits 
> > with errors, and the poff and poweroff commands never get called. Could 
> > someone advise how to modify the script to esure that the last two commands 
> > always get called even if apt-get fails?
> 
> Sure.
> 
> #! /bin/bash
> 
> pon ntl && sleep 35 && apt-get update && apt-get dist-upgrade -dy ; poff && poweroff

If the net is disconnected then poff may fail with "no pppd running"
which would cause poweroff to not be run. so

pon ntl && sleep 35 && apt-get update && apt-get dist-upgrade -dy ; poff ; poweroff

&& when you want the command to be run only when the first one succeeds.
|| when you want the second run if the first fails
; when you want it run regardless

Kind Regards
Crispin Wellington




Reply to: