Sync-kolab-online.sh

From Kolab wiki

Jump to: navigation, search


This is a 2 minute kludge, I am no bash expert, so please feel free to edit and add as you please!

#!/kolab/lib/openpkg/bash
# filename: sync-kolab-online.sh
# version: 0.1
# Author: Hamish Gough <lists@subvs.co.uk>
# Description: Updates clamav and spamassassin for kolab
# Change below to match your setup:
# MAILFROM: Who the mail result will be from
# MAILTO: Who to send the result to
# MAILBODY: Optional text file to put in the mail body - default is blank (/dev/null)
# AMAILLOC: Full path to amail.pl 
# RSYNCCMD: change the paths to suit your situation
#  uses the host's rsync as default, the kolab openpkg does not have rsync
# LOGFILE: Full path to temp log file for confirmation email
# MBOXDUMPCMD: The command to dump the mailboxes db to a text file,
#  you might want to change the file path, but default should be ok
# LDAPDUMPCMD: The command to dump ldap to text
MAILFROM="tony@number10.com"
MAILTO="me@mydomain.com"
MAILBODY="/dev/null"
AMAILLOC="/data2/amail.pl"
RSYNCCMD="/usr/bin/rsync -avz /kolab /backup/"
LOGFILE="/backup/rsync-kolab-online.txt"
MBOXDUMPCMD="sudo -u kolab-r /kolab/bin/ctl_mboxlist -d > /kolab/mailboxes.txt"
LDAPDUMPCMD="/kolab/sbin/slapcat > /kolab/ldapbkup.ldif"
echo `date` > $LOGFILE
echo "I ran the following command: $MBOXDUMPCMD" >> $LOGFILE
$MBOXDUMPCMD
echo "I ran the following command: $LDAPDUMPCMD" >> $LOGFILE
$LDAPDUMPCMD
echo "I ran the following command: $RSYNCCMD" >> $LOGFILE
$RSYNCCMD >> $LOGFILE
$AMAILLOC -s "Data Sync on Kolab Server" -r $MAILFROM -a $LOGFILE $MAILTO < $MAILBODY
Personal tools