I have a very simple backup script for a client. It works great and has been running fine.
I just want to get more info from errors. I'm not a programmer but can understand some of it.
Here's the script:
#!/bin/bash
#
#Simple bash backup script to zip the Doc tree to an #external USB HD
#
OUTPUT=/home/backup/backups/Backup-$(date +%Y-%m-%d).zip
BUDIR="/home/tim/Documents/"
FAILED="The Backup script on the server failed. Please make sure you check the system."
GOOD="System data backup of $BUDIR successful."
EMAIL=`cat /root/backupemail.txt`
SENDER="server.xxxxx.xx@xxxxxx.net"
#echo "Starting backup of $BUDIR to $OUTPUT"
/usr/bin/zip -rq $OUTPUT $BUDIR
if [ $? == 0 ]; then
echo $GOOD |mailx -s "Server Backup status" -r ${SENDER} ${EMAIL}
else
echo $FAILED |mailx -s "Server Backup status" -r ${SENDER} ${EMAIL}
fi
I haven't been able to really find an answer on reporting the error from the script after cron runs the job.
Thanks
Jason
I just want to get more info from errors. I'm not a programmer but can understand some of it.
Here's the script:
#!/bin/bash
#
#Simple bash backup script to zip the Doc tree to an #external USB HD
#
OUTPUT=/home/backup/backups/Backup-$(date +%Y-%m-%d).zip
BUDIR="/home/tim/Documents/"
FAILED="The Backup script on the server failed. Please make sure you check the system."
GOOD="System data backup of $BUDIR successful."
EMAIL=`cat /root/backupemail.txt`
SENDER="server.xxxxx.xx@xxxxxx.net"
#echo "Starting backup of $BUDIR to $OUTPUT"
/usr/bin/zip -rq $OUTPUT $BUDIR
if [ $? == 0 ]; then
echo $GOOD |mailx -s "Server Backup status" -r ${SENDER} ${EMAIL}
else
echo $FAILED |mailx -s "Server Backup status" -r ${SENDER} ${EMAIL}
fi
I haven't been able to really find an answer on reporting the error from the script after cron runs the job.
Thanks
Jason