[aklug] shell script and cron trouble

From: Damien Hull <damien@linuxninjas.tv>
Date: Fri Mar 13 2009 - 07:37:09 AKDT

The following shell script runs fine if I run it manually. If I setup a cron job it ends before tar finishes. Well, that's a guess but the resulting backup is too small. It's also a bad tar file. I hope someone can tell me why it isn't working.

SERVER - Ubuntu running the zimbra email system.

SCRIPT - IF YOU CAN CALL IT THAT

#! /bin/sh
#
# This script should backup zimbra email in /opt
# Backups will go in /home/backupdata/zimbra/

# post to linuxninjas.tv
/usr/local/sbin/linuxninjas.sh "Backing up email..."

# shutdown zimbra
/etc/init.d/zimbra stop
sleep 3

# backup zimbra
tar -cf /home/backupdata/zimbra/zimbra-$(date +%F-%T).tar /opt/zimbra
sleep 3

# start zimbra
/etc/init.d/zimbra start

# change file permissions
chown -R backupdata:backupdata /home/backupdata/zimbra

# post to linuxninjas.tv
/usr/local/sbin/linuxninjas.sh "Backup of email is done..."

-- 
Damien Hull
Linux Ninja
Open Source Assassin
http://linuxninjas.tv
http://elite.linuxninjas.tv
http://www.digital-overload.net
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Fri Mar 13 07:37:23 2009

This archive was generated by hypermail 2.1.8 : Fri Mar 13 2009 - 07:37:23 AKDT