[NCLUG] Oops,

Zak Smith zak at computer.org
Fri Feb 21 11:46:05 MST 2014


On Fri, Feb 21, 2014 at 08:54:37AM -0700, Bob Proulx wrote:
> #!/bin/sh
> cd /home || exit 1
> tar cvzf /mnt/UserBackup/BKkerrym2.tar.gz \
>   --one-file-system \
>   --exclude=kerrym2/KerrysStuff \
>   --exclude=kerrym2/Pictures \
>   --exclude=kerrym2/Downloads \
>   --exclude=kerrym2/.wine/drive_c \
>   kerrym2
> # Let the exit value of tar "fall through" the bottom of the script.
> # The shell exits with the exit status of the last command.

On this note, I often use "set -e" to make sure the script stops if
there is an error.  Obviously the comments about cleaning up temp
files applies in this case, and commands that "may" fail must be
adjusted (such as rm vs rm -f).

Another note on cron jobs, check out cronic, http://habilis.net/cronic/

It is meant to allow silent success but email on failure.



--
# Zak Smith    mobile 970-232-4468



More information about the NCLUG mailing list