"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "utils/FOGBackup/FOGBackup.sh" between
fogproject-1.5.6.tar.gz and fogproject-1.5.7.tar.gz

About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn\PKG_DESCR_TTrsquo;t use any boot disks, or CDs; everything is done via TFTP and PXE.

FOGBackup.sh  (fogproject-1.5.6):FOGBackup.sh  (fogproject-1.5.7)
#!/bin/bash #!/bin/bash
usage() { usage() {
echo -e "Usage: $0 [-h?] [-B </backup/path/>]" echo -e "Usage: $0 [-h?] [-B </backup/path/>]"
echo -e "\t-h -? --help\t\t\tDisplay this info" echo -e "\t-h -? --help\t\t\tDisplay this info"
echo -e "\t-B -b --backuppath\t\tSpecify the backup path.\n\t\tIf not set wi ll use backupPath from fog settings plus fog_backup_DATE." echo -e "\t-B -b --backuppath\t\tSpecify the backup path.\n\t\tIf not set wi ll use backupPath from fog settings plus fog_backup_DATE."
echo -e "\t --no-reports\t\tOmit backup of reports"
echo -e "\t --no-snapins\t\tOmit backup of snapins"
echo -e "\t --no-images\t\tOmit backup of images"
} }
. ../../lib/common/utils.sh . ../../lib/common/utils.sh
optspec="h?B:b:-:" optspec="h?B:b:-:"
while getopts "$optspec" o; do while getopts "$optspec" o; do
case $o in case $o in
-) -)
case $OPTARG in case $OPTARG in
help) help)
usage usage
exit 0 exit 0
;; ;;
backuppath) backuppath)
if [[ ! -d $OPTARG ]]; then if [[ ! -d $OPTARG ]]; then
usage usage
handleError "Path must be an existing directory" 8 handleError "Path must be an existing directory" 8
fi fi
backupPath=$OPTARG backupPath=$OPTARG
;; ;;
no-reports)
noBackupReports=1
;;
no-snapins)
noBackupSnapins=1
;;
no-images)
noBackupImages=1
;;
*) *)
if [[ $OPTERR -eq 1 && ${optspec:0:1} != : ]]; then if [[ $OPTERR -eq 1 && ${optspec:0:1} != : ]]; then
usage usage
handleError "Unknown option: --${OPTARG}" 9 handleError "Unknown option: --${OPTARG}" 9
fi fi
;; ;;
esac esac
;; ;;
[Hh]|'?') [Hh]|'?')
usage usage
skipping to change at line 70 skipping to change at line 82
usage usage
handleError "Path must be an existing directory" 8 handleError "Path must be an existing directory" 8
fi fi
backupDate=$(date +"%Y%m%d"); backupDate=$(date +"%Y%m%d");
backupDir="$backupPath/$backupDate" backupDir="$backupPath/$backupDate"
cd $backupPath cd $backupPath
countBackup=`ls | grep $backupDate | wc -l` countBackup=`ls | grep $backupDate | wc -l`
backupDir="${backupDir}_$countBackup" backupDir="${backupDir}_$countBackup"
[[ ! -d $backupDir ]] && mkdir -p $backupDir/{images,mysql,snapins,reports,logs} >/dev/null 2>&1 [[ ! -d $backupDir ]] && mkdir -p $backupDir/{images,mysql,snapins,reports,logs} >/dev/null 2>&1
[[ ! -d $backupDir/images || $backupDir/mysql || $backupDir/snapins || $backupDi r/reports || $backupDir/logs ]] && mkdir -p $backupDir/{images,mysql,snapins,rep orts,logs} >/dev/null 2>&1 [[ ! -d $backupDir/images || $backupDir/mysql || $backupDir/snapins || $backupDi r/reports || $backupDir/logs ]] && mkdir -p $backupDir/{images,mysql,snapins,rep orts,logs} >/dev/null 2>&1
echo " * Backup location: $backupDir"
backupDB() { backupDB() {
dots "Backing up database" dots "Backing up database"
wget --no-check-certificate --post-data="nojson=1" -O $backupDir/mysql/fog.s ql "http://$ipaddress/$webroot/management/export.php?type=sql" 2>>$backupDir/log s/error.log 1>>$backupDir/logs/progress.log 2>&1 wget --no-check-certificate --post-data="nojson=1" -O $backupDir/mysql/fog.s ql "http://$ipaddress/$webroot/management/export.php?type=sql" 2>>$backupDir/log s/error.log 1>>$backupDir/logs/progress.log 2>&1
stat=$? stat=$?
if [[ ! $stat -eq 0 ]]; then if [[ ! $stat -eq 0 ]]; then
echo "Failed" echo "Failed"
handleError "Could not create/download sql backup file" 12 handleError "Could not create/download sql backup file" 12
fi fi
} }
backupImages() { backupImages() {
skipping to change at line 117 skipping to change at line 130
stat=$? stat=$?
if [[ ! $stat -eq 0 ]]; then if [[ ! $stat -eq 0 ]]; then
echo "Failed" echo "Failed"
handleError "Could not backup reports" 17 handleError "Could not backup reports" 17
fi fi
echo "Done" echo "Done"
} }
starttime=$(date +%D%t%r) starttime=$(date +%D%t%r)
echo " * Started backup at: $starttime" echo " * Started backup at: $starttime"
backupDB backupDB
backupReports [[ "$noBackupReports" -ne 1 ]] && backupReports
backupSnapins [[ "$noBackupSnapins" -ne 1 ]] && backupSnapins
backupImages [[ "$noBackupImages" -ne 1 ]] && backupImages
endtime=$(date +%D%t%r) endtime=$(date +%D%t%r)
echo " * Completed backup at: $endtime" echo " * Completed backup at: $endtime"
 End of changes. 4 change blocks. 
3 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)