Subversion Repositories oZimbraBackup

Rev

Rev 2 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 4
Line 21... Line 21...
21
# Bits and pieces was adopted from a script created by Daniel W. Martin, 9 Sept 2007
21
# Bits and pieces was adopted from a script created by Daniel W. Martin, 9 Sept 2007
22
# Licensed under BSDL license, see license.txt for information.
22
# Licensed under BSDL license, see license.txt for information.
23
#
23
#
24
# Developer: oSource Development(as of 2009-07-01)
24
# Developer: oSource Development(as of 2009-07-01)
25
# DevTeam: Marcus Uddenhed
25
# DevTeam: Marcus Uddenhed
26
# Version: 1.0.6
26
# Version: 1.0.7
27
# Updated: 2014-05-18 16:00
27
# Updated: 2015-12-14 22:17
28
#
28
#
29
 
29
 
30
#### Global Settings ####
30
#### Global Settings ####
31
ZimInstPath=/opt			# Installation path for Zimbra, excluding the Zimbra folder.
31
ZimInstPath=/opt			# Installation path for Zimbra, excluding the Zimbra folder.
32
ZimHome=zimbra				# The Zimbra installation folder, excluding path to folder.
32
ZimHome=zimbra				# The Zimbra installation folder, excluding path to folder.
Line 515... Line 515...
515
  then
515
  then
516
   # Sending task start time to log
516
   # Sending task start time to log
517
   echo "`date "+%Y-%m-%d %H:%M:%S"` - Zimbra services starting..." >> $ZimLogFile
517
   echo "`date "+%Y-%m-%d %H:%M:%S"` - Zimbra services starting..." >> $ZimLogFile
518
 
518
 
519
   # Starting Zimbra
519
   # Starting Zimbra
520
   su zimbra -c -l "zmcontrol start" >> $ZimLogFile
520
   su zimbra -c -l "$ZimInstPath/$ZimHome/bin/zmcontrol start" >> $ZimLogFile
521
 
521
 
522
   # Send task stop time to log
522
   # Send task stop time to log
523
   echo "`date "+%Y-%m-%d %H:%M:%S"` - Zimbra services started." >> $ZimLogFile
523
   echo "`date "+%Y-%m-%d %H:%M:%S"` - Zimbra services started." >> $ZimLogFile
524
 
524
 
525
  else
525
  else
526
 
526
 
527
   # Starting Zimbra
527
   # Starting Zimbra
528
   su zimbra -c -l "zmcontrol start"
528
   su zimbra -c -l "$ZimInstPath/$ZimHome/bin/zmcontrol start"
529
 
529
 
530
  fi
530
  fi
531
fi
531
fi
532
}
532
}
533
 
533
 
Line 538... Line 538...
538
 
538
 
539
  # Sending task start time to log
539
  # Sending task start time to log
540
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Zimbra services stopping..." >> $ZimLogFile
540
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Zimbra services stopping..." >> $ZimLogFile
541
 
541
 
542
  # Stopping Zimbra
542
  # Stopping Zimbra
543
  su zimbra -c -l "zmcontrol stop" >> $ZimLogFile
543
  su zimbra -c -l "$ZimInstPath/$ZimHome/bin/zmcontrol stop" >> $ZimLogFile
544
 
544
 
545
  # Sending task stop time to log
545
  # Sending task stop time to log
546
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Zimbra services stopped." >> $ZimLogFile
546
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Zimbra services stopped." >> $ZimLogFile
547
 
547
 
548
  # Sleep for 10 seconds to give shutdown some extra time before backup starts
548
  # Sleep for 10 seconds to give shutdown some extra time before backup starts
549
  sleep 10
549
  sleep 10
550
 
550
 
551
else
551
else
552
 
552
 
553
  # Stopping Zimbra
553
  # Stopping Zimbra
554
  su zimbra -c -l "zmcontrol stop"
554
  su zimbra -c -l "$ZimInstPath/$ZimHome/bin/zmcontrol stop"
555
 
555
 
556
  # Sleep for 10 seconds to give shutdown some extra time before backup starts
556
  # Sleep for 10 seconds to give shutdown some extra time before backup starts
557
  sleep 10
557
  sleep 10
558
 
558
 
559
fi
559
fi
Line 657... Line 657...
657
mkdir -p $ZimDiffTmpPath
657
mkdir -p $ZimDiffTmpPath
658
mkdir -p $ZimMsgFullTmpPath
658
mkdir -p $ZimMsgFullTmpPath
659
mkdir -p $ZimMsgDiffTmpPath
659
mkdir -p $ZimMsgDiffTmpPath
660
}
660
}
661
 
661
 
662
restore_guide() {
-
 
663
echo "Restore Guide"
-
 
664
}
-
 
665
 
-
 
666
script_help() {
662
script_help() {
667
# Show help for script
663
# Show help for script
668
echo "oZimBackup.sh Usage:"
664
echo "oZimBackup.sh Usage:"
669
echo ""
665
echo ""
670
echo "--full			For full backup (Cold)"
666
echo "--full			For full backup (Cold)"
671
echo "--diff			For differential backup (Cold)"
667
echo "--diff			For differential backup (Cold)"
672
echo "--msg-full		For complete message backup (Hot)"
668
echo "--msg-full		For complete message backup (Hot)"
673
echo "--msg-diff		For differential message backup (Hot)"
669
echo "--msg-diff		For differential message backup (Hot)"
674
echo "--check			Check if needed software is installed, depends"
670
echo "--check			Check if needed software is installed, depends"
675
echo "				on script configuration"
671
echo "				on script configuration"
676
echo "--restore-guide		Shows a short guide on how to restore Zimbra"
-
 
677
#echo "--full-restore		Does a complete restore"
-
 
678
#echo "--diff-restore		Restores a differential backup"
-
 
679
echo "--help			Shows this help"
672
echo "--help			Shows this help"
680
echo ""
673
echo ""
681
echo "--no-start		Tells Zimbra to stay offline after backup"
674
echo "--no-start		Tells Zimbra to stay offline after backup"
682
#echo "<file to restore>	File to restore from"
675
#echo "<file to restore>	File to restore from"
683
echo ""
676
echo ""
684
echo "Ex. Full backup:"
677
echo "Ex. Full backup:"
685
echo " oZimBackup.sh --full"
678
echo " oZimBackup.sh --full"
686
echo ""
679
echo ""
687
#echo "Ex. Complete restore:"
-
 
688
#echo " oZimBackup.sh --full-restore /path/to/file/zimbackup.tar.gz"
-
 
689
echo ""
-
 
690
echo "Ex. Full differential backup leaving Zimbra in offline mode:"
680
echo "Ex. Full differential backup leaving Zimbra in offline mode:"
691
echo " oZimBackup.sh --diff --no-start"
681
echo " oZimBackup.sh --diff --no-start"
692
echo ""
682
echo ""
693
}
683
}
694
 
684
 
Line 723... Line 713...
723
log_start
713
log_start
724
msgdiff_backup
714
msgdiff_backup
725
file_transfer
715
file_transfer
726
log_end
716
log_end
727
;;
717
;;
728
--full-restore)
-
 
729
full_restore
-
 
730
;;
-
 
731
--diff-restore)
-
 
732
diff_restore
-
 
733
;;
-
 
734
--restore-guide)
-
 
735
restore_guide
-
 
736
;;
-
 
737
--check)
718
--check)
738
pre_check
719
pre_check
739
;;
720
;;
740
--help)
721
--help)
741
script_help
722
script_help
742
;;
723
;;
743
*)
724
*)
744
script_help
725
script_help
745
;;
726
;;
746
esac
727
esac
747
728