Backup zimbra folder to external hardisk
- Log in to Zimbra server by root login
- mkdir 1
- chmod -R 777 mailbackup
- cd /opt/ // access to opt folder
- touch backup.sh
- chmod 777 backup.sh
- nano backup.sh
- paste the below coding (Red coding)
- format your external hard disk to ext 4 format (Software:- mini partition)
- Plug your external hard disk to Zimbra mail server
- fdisk -l // identity the hard disk mount name such /dev/sda1/ or /dev/sdb1
- Example :- Disk /dev/sdb1: 160.0 GB, 160041885696 bytes
- As per hard disk mount name change the script according line 9 mount /dev/sdb1 /mailbackup or /dev/sda1/ mailbackup
- At final run the script ./backup.sh
- Press 'y' to perform the backup while backup zmcontrol service will be stop
- Additional before preform the backup please external hard disk is plugged and mount to correct drive letter.
----------------------------------------------------------------------------------------------------------------------------------
stty intr '^-' kill '^-' susp '^-' stop '^-' quit '^-'
s()
{
echo " Please press y to continue or n to quit :"
read ans;
if [ $ans = "y" ]; then
su zimbra -c "/opt/zimbra/bin/zmcontrol stop"
sleep 60;
mount /dev/sdb1 /1
echo "BACKUP STARTa"
tar -cvf /1/backup.tar /opt/zimbra
echo "BACKUP COMPLETED"
sleep 60;
umount /1
su zimbra -c "/opt/zimbra/bin/zmcontrol start"
fi
}
restart()
{
echo " Do you really want to restart mail server if yes press y or n to quit :"
read ans;
if [ $ans = "y" ]; then
su zimbra -c "/opt/zimbra/bin/zmcontrol stop"
init 6;
echo "Server Rebooting"
echo ""
fi
}
menu()
{
option=""
while ( true )
do
echo "\n\n"
echo " 1 -> Take Backup "
echo " 2 -> Restart Server "
echo " q -> QUIT\n "
echo " To select any of the options, enter the number"
echo " Enter your choice : \c"
read option
case $option in
1) s
;;
2) restart
;;
'q'|'Q') exit 0
;;
*) echo "Invalid option."
echo "Hit return for the menu ...\c"
read
;;
esac
done
}
menu
------------------------------------------------------------------------------------------------------------
Thanks for sharing,get an Zimbra mail server provider in chennai.
ReplyDelete