As you can see, I have not made the changes to run the omcpoutu processes in the background. Still waiting on word from Florian.
Code: Select all
function dump_users
{
# Build userfile
$SCALIX_BIN/omshowu -m $MAILNODE|cut -f1 -d'/' >$USERFILE
[ "$?" != "0" ] && exit_with_error "Unable to build userfile $USERFILE from mailnode $MAILNODE"
# Loop over userfile and create backups. Use 'while read' instead of 'for' because of spaces in names
while read sc_username
do
echo "Processing $sc_username ..."
# Create a version of the username without spaces and other crappy characters
nospaces=`echo $sc_username|sed -e "s/[ \.;=*'?_!]//g"`
REMOTE_BACKUP_FILE="$REMOTE_BACKUP_DIR/$MAILNODE/${nospaces}-${DATE}-mail.gz"
# Lock the user's account so they can't reconnect when you log them off
$SCALIX_BIN/ommodu "$sc_username" -K || echo_and_log "Error: Unable to LOCK the account of $sc_username"
# Disconnect them from the system
kill -9 `$SCALIX_BIN/omstat -u rci -c |grep "$sc_username" |awk '{ print $6 }'`
# Compress and send the backup mailbox file to its remote home
$SCALIX_BIN/omcpoutu -n "$sc_username/$MAILNODE" -f - | gzip | ssh $REMOTE_BACKUP_HOST "cat > $REMOTE_BACKUP_FILE"
if [ "$?" != "0" ]
then
echo_and_log "Error: Unable to complete backup operation for $sc_username to $REMOTE_BACKUP_HOST:$REMOTE_BACKUP_FILE"
else
echo "Success: Backed up to $REMOTE_BACKUP_HOST:$REMOTE_BACKUP_FILE"
fi
# Unlock the user's account when we are done with the backup
$SCALIX_BIN/ommodu "$sc_username" -k || echo_and_log "Error: Unable to UNLOCK the account of $sc_username"
done < $USERFILE
}