Subversion Repositories oZimbraBackup

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 3
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
 
2
 
-
 
3
#
3
# This script will do various backups of Zimbra depending on which you choose,
4
# This script will do various backups of Zimbra depending on which you choose,
4
# most of them are cold backups except the msg backup which hot copies the 'store'
5
# most of them are cold backups except the msg backup which hot copies the 'store'
5
# folder for possible individual mail retrieval. Be sure to change the variables below
6
# folder for possible individual mail retrieval. Be sure to change the variables below
6
# to point to where you got the Zimbra folder and where you want it to be backed up to.
7
# to point to where you got the Zimbra folder and where you want it to be backed up to.
7
#
8
#
Line 20... Line 21...
20
# 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
21
# Licensed under BSDL license, see license.txt for information.
22
# Licensed under BSDL license, see license.txt for information.
22
#
23
#
23
# Developer: oSource Development(as of 2009-07-01)
24
# Developer: oSource Development(as of 2009-07-01)
24
# DevTeam: Marcus Uddenhed
25
# DevTeam: Marcus Uddenhed
25
# Version: 1.0.5
26
# Version: 1.0.6
26
# Last updated: 2012-01-02 23:15
27
# Updated: 2014-05-18 16:00
-
 
28
#
27
 
29
 
28
#### Global Settings ####
30
#### Global Settings ####
29
ZimInstPath=/opt			# Installation path for Zimbra, excluding the Zimbra folder.
31
ZimInstPath=/opt			# Installation path for Zimbra, excluding the Zimbra folder.
30
ZimHome=zimbra				# The Zimbra installation folder, excluding path to folder.
32
ZimHome=zimbra				# The Zimbra installation folder, excluding path to folder.
31
ZimBackupPath=/opt/backup		# Root folder for backup where backup files will be placed.
33
ZimBackupPath=/opt/backup		# Root folder for backup where backup files will be placed.
Line 314... Line 316...
314
 
316
 
315
file_transfer() {
317
file_transfer() {
316
# Transfer with ftp
318
# Transfer with ftp
317
if [ $ZimFtpEnable == "yes" ]
319
if [ $ZimFtpEnable == "yes" ]
318
then
320
then
-
 
321
if [ "$2" = "--no-send" ]
-
 
322
then
-
 
323
  # If --no-send is set ignore sending file to off site.
-
 
324
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Backup not sending backup file to external storage, --no-send is set." >> $ZimLogFile
-
 
325
  echo "Not sending backup to external storage, --no-send is set."
-
 
326
else
319
if [ $ZimLogEnable = 'yes' ] && [ $ZimLogVerbose = 'yes' ]
327
if [ $ZimLogEnable = 'yes' ] && [ $ZimLogVerbose = 'yes' ]
320
 then
328
 then
321
  # Send task start time to log
329
  # Send task start time to log
322
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Sending file via ftp to off-site storage..." >> $ZimLogFile
330
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Sending file via ftp to off-site storage..." >> $ZimLogFile
323
 
331
 
Line 380... Line 388...
380
  # Send task stop time to log
388
  # Send task stop time to log
381
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Sending file via ftp to off-site storage done." >> $ZimLogFile
389
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Sending file via ftp to off-site storage done." >> $ZimLogFile
382
 
390
 
383
 fi
391
 fi
384
fi
392
fi
-
 
393
fi
385
 
394
 
386
# Transfer with scp
395
# Transfer with scp
387
if [ $ZimScpEnable == "yes" ]
396
if [ $ZimScpEnable == "yes" ]
388
then
397
then
-
 
398
if [ "$2" = "--no-send" ]
-
 
399
then
-
 
400
  # If --no-send is set ignore sending file to off site.
-
 
401
  echo "`date "+%Y-%m-%d %H:%M:%S"` - Backup not sending backup file to external storage, --no-send is set." >> $ZimLogFile
-
 
402
  echo "Not sending backup to external storage, --no-send is set."
-
 
403
else
389
 if [ $ZimLogEnable = 'yes' ] && [ $ZimLogVerbose = 'yes' ]
404
 if [ $ZimLogEnable = 'yes' ] && [ $ZimLogVerbose = 'yes' ]
390
  then
405
  then
391
 
406
 
392
  # Send task start time to log
407
  # Send task start time to log
393
   echo "`date "+%Y-%m-%d %H:%M:%S"` - Sending file via scp to off-site storage..." >> $ZimLogFile
408
   echo "`date "+%Y-%m-%d %H:%M:%S"` - Sending file via scp to off-site storage..." >> $ZimLogFile
Line 437... Line 452...
437
   # Send task stop time to log
452
   # Send task stop time to log
438
   echo "`date "+%Y-%m-%d %H:%M:%S"` - Sending file via scp to off-site storage done." >> $ZimLogFile
453
   echo "`date "+%Y-%m-%d %H:%M:%S"` - Sending file via scp to off-site storage done." >> $ZimLogFile
439
 
454
 
440
 fi
455
 fi
441
fi
456
fi
-
 
457
fi
442
 
458
 
443
# Remove local file(s) if ZimDeleteLocalFile is set to 'yes'
459
# Remove local file(s) if ZimDeleteLocalFile is set to 'yes'
444
if [ $ZimDeleteLocalFile == "yes" ]
460
if [ $ZimDeleteLocalFile == "yes" ]
445
then
461
then
446
 if [ $ZimLogEnable = 'yes' ] && [ $ZimLogVerbose = 'yes' ]
462
 if [ $ZimLogEnable = 'yes' ] && [ $ZimLogVerbose = 'yes' ]