Hi All
I have been following a post ref setting up mailbox back up on the community edition (my version 7.02) [SOLVED] Individual HOT user backups - Community Version
The issue is when I run the script which creates a new file with the mail accounts. The email accounts with long names get cut short so the backup of them fail as the full name is not in the new script. This is the file that gets the user accounts
#!/bin/bash
# baccount.sh -- Script to export select Zimbra accounts
USERNAME=$1
TODAY=`date`
LOGFILE="/backup/log/backuplog.txt"
echo $TODAY >> $LOGFILE
echo $USERNAME >> $LOGFILE
/opt/zimbra/bin/zmmailbox -z -m $USERNAME gms >> $LOGFILE
/opt/zimbra/bin/zmmailbox -z -m $USERNAME getRestURL "//?fmt=tgz" > /backup/accounts/$USERNAME.tgz
echo --------------------- >> $LOGFILE
And this is the second script involved
#!/bin/bash
# get a list of all the accounts and create a script to
# execute the baccount.sh script with the email address
# of the user as a command line variable
#use zmaccts and extract only the email address from the result
#then concatenate the "/backup/./baccount.sh <emailaddress>" string for each account and write it to the file
/opt/zimbra/bin/./zmaccts | grep "@" | awk '{print "/backup/./baccount.sh " $1}' > /backup/accountbackup.sh
# change permissions on the newly created script
chmod 755 /backup/accountbackup.sh
# Execute the newly created script - this creates a tgz file for each account
/backup/./accountbackup.sh
# this mounts an SMB drive of a neighboring win machine and copies the backups over - could be anything
# mount -t smbfs -o username=username,password=password //windowsMachineName/windowsShare /data
# cp /backup/accounts/*.tgz /data
Can anyone suggest how I can get the full name of those few accounts that this script cuts short
Many thanks
Glenn


LinkBack URL
About LinkBacks

