On Mon, 21 Feb 2000, Stefan Troeger wrote:
dothis && dothat && anddothattoo && echo "done" |mail jpennington -s "done" || echo "failed" |mail jpennington -s "failed"
Okay, I've cleaned up my script quite a bit since this posting. The part that still eludes me is the usage of the || operator. Remember, I've never written a script in my life ;) #!/bin/sh # Script to create daily backups of the IRM database IRM_DATE=`date '+%y%m%d'` IRM_DUMP=/tmp/irm-$IRM_DATE.dump IRM_BACKUP=/tmp/irm-$IRM_DATE.dump.gz # Establishes values for variables used later. mysqldump -u irm -pqwerty69 irm > $IRM_DUMP && gzip $IRM_DUMP && # Creates the dump file and compresses it. mv $IRM_BACKUP /home/irmadmin && chown irmadmin.users /home/irmadmin/irm-$IRM_DATE.dump.gz && chmod 600 /home/irmadmin/irm-$IRM_DATE.dump.gz && # Makes the compressed dump file property of the irmadmin user echo "$IRM_BACKUP was successfully created." | mail irmadmin -s $IRM_BACKUP # Notifies irmadmin of (un)successful backup creation # EOF If a backup or a fake backup file exists (/tmp/irm-$IRM_DATE.dump.gz), gz asks if I want to overwrite it. Since this script is meant to be non-interactive, what would you do if you wanted to overwrite the file automatically? I still don't know how an error could be trapped and an alternate message sent; would you mind elaborating on that concept a bit? -- -=|JP|=- Jon Pennington | Atipa Linux Solutions -o) jpennington@atipa.com | Kansas City, MO /\\ 816-241-2641 x107 | http://www.atipa.com _\_V -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/