From 44d8224ff0d4be30bd6a72da2687660c4f27622f Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Fri, 21 Oct 2011 03:20:36 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- .gitignore | 20 + README.md | 8 +- etc/lbackup/example_backup_config/README.TXT | 8 +- .../example_backup_config/example_backup.conf | 70 +-- .../example_backup_config/example_mail.conf | 18 +- .../start_backup/backup.bash | 4 +- .../start_backup/mount_volume_ssh.bash | 10 +- .../start_backup/start_backup.bash | 14 +- ...-Link-To-Backup-Destination-Directory.bash | 30 +- ...ink-To-Backup-Configuration-Directory.bash | 42 +- ...ate-Time-Based-Backup-Links-Directory.bash | 44 +- .../BACKUP-500-EjectDiskImage.bash | 40 +- .../BACKUP-600-UnMountBackupVolume.bash | 30 +- ...00-Sync-Sparse-Image-to-Remote-Server.bash | 30 +- ...Image-to-Locally-Accessible-Directory.bash | 10 +- .../BACKUP-800-ArchiveRsyncSessionLog.bash | 38 +- .../BACKUP-950-ReportDiskUsageDifference.bash | 28 +- .../BACKUP-990-ReportCompletionTime.bash | 6 +- ...eckBackupDestinationDirecotyAvailible.bash | 6 +- .../BACKUP-100-BasicMountDiskImage.bash | 16 +- .../BACKUP-100-MountDiskImage.bash | 46 +- .../BACKUP-101-ClearRsyncSessionLog.bash | 22 +- .../BACKUP-150-LogSystemDiskUsage.bash | 20 +- ...UP-200-CheckBackupDiskUsagePercentage.bash | 10 +- ...P-200-ReportBackupDiskUsagePercentage.bash | 10 +- ...BACKUP-300-EnsureFailedBackupWritable.bash | 6 +- .../BACKUP-500-Check-Directory-Exists.bash | 4 +- .../BACKUP-500-Check-File-Is-Not-Present.bash | 6 +- .../BACKUP-550-EnsureDiskImageNotMounted.bash | 12 +- .../pre-actions/BACKUP-999-OpenLog.bash | 4 +- .../resources/ssh-wrappers/README.txt | 6 +- .../resources/ssh-wrappers/lbackup-wrapper.sh | 44 +- usr/local/libexec/lbackup1001/Version History | 283 ++++++------ .../libexec/lbackup1001/backup_script.bash | 408 +++++++++--------- .../backup_version/backup_script.bash | 326 +++++++------- .../backup_version/maillog_script.bash | 122 +++--- .../interfaces/lbackup_change_directory.bash | 50 +-- .../libexec/lbackup1001/maillog_script.bash | 124 +++--- .../message_templates/mail_error.sh | 4 +- .../mail_logerror_attachment.sh | 6 +- .../message_templates/mail_standard.sh | 4 +- .../mail_standard_attachment.sh | 2 +- usr/local/libexec/lbackup1001/todo | 13 +- .../lbackup1001/utilities/base64encode.py | 4 +- .../libexec/lbackup1001/utilities/checklog.py | 41 +- .../default_backup_post_action.bash | 36 +- .../default_backup_pre_action.bash | 30 +- .../default_mail_post_action.bash | 34 +- .../default_mail_pre_action.bash | 32 +- .../default_scripts/script_return_codes.conf | 4 +- ...tialize_disk_image_pre_and_post_hooks.bash | 36 +- .../libexec/lbackup1001/utilities/wake.py | 42 +- usr/share/doc/lbackup/copyright | 6 +- usr/share/man/man1/lbackup.1 | 8 +- 54 files changed, 1147 insertions(+), 1130 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac8f968 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc + +# Logs and databases # +###################### +*.log + +# OS generated files # +###################### +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db diff --git a/README.md b/README.md index c607f75..d9f6c59 100644 --- a/README.md +++ b/README.md @@ -12,16 +12,16 @@ License: [GNU General Public License v3][1] Additional Information --------- -Further information including basic and more advanced usage is available from the following URL: +Further information including basic and more advanced usage is available from the following URL: -If you wish to build an OS X package installer then the following project will be of interest : +If you wish to build an OS X package installer then the following project will be of interest : -If you wish to build a .deb installer for use on debian based operating systems then the following project will be of interest : +If you wish to build a .deb installer for use on debian based operating systems then the following project will be of interest : -Instructions for installing directly from source are available from the following URL : +Instructions for installing directly from source are available from the following URL : diff --git a/etc/lbackup/example_backup_config/README.TXT b/etc/lbackup/example_backup_config/README.TXT index c60d14d..acec959 100644 --- a/etc/lbackup/example_backup_config/README.TXT +++ b/etc/lbackup/example_backup_config/README.TXT @@ -4,16 +4,16 @@ It is strongly recommended that you check the documentation available from the following URL for information regarding the installation and use of LBACKUP. -LBackup Home (online documentation) : +LBackup Home (online documentation) : http://www.lbackup.org -For instructions on setting up your first test backup visit : +For instructions on setting up your first test backup visit : http://lucidsystems.org/tools/lbackup/instructions/setup -To signup to the LBackup mailing lists vista the URL below: +To signup to the LBackup mailing lists vista the URL below: http://www.lucidsystems.org/tools/lbackup/lists/ -Lucid offers information storage and processing consultation and support services. Including support for LBackup : +Lucid offers information storage and processing consultation and support services. Including support for LBackup : http://www.lucidsystems.org LBackup uses rsync to copy and compare files. It is important that the copy of rsync installed and referenced by LBackup supports coping metadata which you or your policies require. Check the online documentation for the latest information regarding compiling and installing rsync, particularly if you are running Mac OS X. Also note that many versions of rsync which are available do not work correctly with symbolic links. Ensure that your version is working if you have symbolic links in your backup tree. diff --git a/etc/lbackup/example_backup_config/example_backup.conf b/etc/lbackup/example_backup_config/example_backup.conf index 484b68a..f50b4e4 100755 --- a/etc/lbackup/example_backup_config/example_backup.conf +++ b/etc/lbackup/example_backup_config/example_backup.conf @@ -20,7 +20,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ################################################## -################################################## +################################################## ## ## ## The origional developer of this software ## ## maintains rights as specified in the ## @@ -37,10 +37,10 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Backup should be called as listed below : # eg . /usr/local/sbin/lbackup /path/to/this/script.conf # -# This configuration file requires +# This configuration file requires # LBackup version 0.9.8r5 or later. # -# For a less complex example backup configuration file visit : +# For a less complex example backup configuration file visit : # http://lucidsystems.org/tools/lbackup/instructions/setup # @@ -58,7 +58,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin -# Is the source for this backup located on a remote machine accessed via SSH (YES/NO) +# Is the source for this backup located on a remote machine accessed via SSH (YES/NO) useSSH="YES" @@ -66,12 +66,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Power management Settings # MAC address of machine to be woken hardware_address="00:03:93:B0:A0:BA" - # determines weather or not to wake/sleep the client machine on the LAN (YES/NO) + # determines weather or not to wake/sleep the client machine on the LAN (YES/NO) WAKE="NO" SLEEP="NO" -# Send Growl Notification (YES/NO) +# Send Growl Notification (YES/NO) sendGrowlNotification="NO" @@ -92,10 +92,10 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin excludes_filename=excludes.txt -## Availability Tests (YES/NO) +## Availability Tests (YES/NO) SSHTest="YES" PingTest="NO" - + @@ -115,7 +115,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # the oldest backup snapshot and also any failed backup (YES/NO) # report_removal_times_human_readable="YES" -## Report in a (human readable format) the amount of time required for rsync +## Report in a (human readable format) the amount of time required for rsync # to complete the rsync snapshot (YES/NO) # report_snapshot_time_human_readable="YES" @@ -128,8 +128,8 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Name of the associated mail config file (file needs to be in same directory) mailconfigpartner=example_mail.conf - -# Send an email even if the backup is successful. (YES/NO) + +# Send an email even if the backup is successful. (YES/NO) # Notes : Be warned if you have a lot of backups then you do not want to enable this. # Consider running lmail on a schedule or have a look at the lbackup home # and search for "monitoring multiple backup logs". This option will forward @@ -141,30 +141,30 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Disable the sending of email reports / alerts (YES/NO) # Notes : This option is experimental and may be removed from future releases. # Enabling this option will mean that you disable the sending of email. -# Enabling this option is not compatible with when the option +# Enabling this option is not compatible with when the option # email_and_archive_log_on_successful_backup is enabled. # disable_mailconfigpartner="NO" - - - - - + + + + + ## -## Change Logging ( requires rsync version 3 or later - experimental options) +## Change Logging ( requires rsync version 3 or later - experimental options) ## - + # List changes in the standard log file (YES/NO) # Note : This feature is experimental. itemize_changes_to_standard_log="NO" # List changes in a separate log file (YES/NO) # Note: If you would like to see which files are changing during a -# backup then this is the recommended method. If enabled file -# called "rsync_session.log" will be created within your -# configuration directory. This file will contain a list of +# backup then this is the recommended method. If enabled file +# called "rsync_session.log" will be created within your +# configuration directory. This file will contain a list of # changes as well as additional rsync information. This file # can easily grow very large. Therefore, if this option is -# enabled it is recommended that this file is removed or +# enabled it is recommended that this file is removed or # archived by a pre or post action script. enable_rsync_session_log="NO" @@ -174,11 +174,11 @@ enable_rsync_session_log="NO" ## -## Backup Lock Override (experimental option - may be removed from future version) +## Backup Lock Override (experimental option - may be removed from future version) ## - + # Note : This feature is experimental. Only enable if you are sure that an override is required. -# You may want to enable this feature if the user executing the backup dose not have +# You may want to enable this feature if the user executing the backup dose not have # write access to the backup directory. Future versions of LBackup may offer the # option of specifying the absolute lock file path from within the configuration # file. @@ -218,7 +218,7 @@ enable_rsync_session_log="NO" ## -## LBackup Rsync Options +## LBackup Rsync Options ## # If you are using Mac OS X on both the client and server then you should @@ -227,18 +227,18 @@ enable_rsync_session_log="NO" # these options may change in future LBackup releases. # Override Rsync Path when backup occurs via SSH (eg. /usr/bin/rsync) - + #ssh_rsync_path_remote="/usr/bin/rsync" # ( Use standard version of Rsync - LINUX - Client ) #ssh_rsync_path_local="/usr/bin/rsync" # ( Use standard version of Rsync - LINUX - Server ) - + #ssh_rsync_path_remote="/usr/local/bin/rsync_v3" # ( Use custom version of rsync - OSX - Client) #ssh_rsync_path_local="/usr/local/bin/rsync_v3" # ( Use custom version of rsync - OSX - Server) - - + + # Use this custom rsync path if we are performing a local backup on Darwin # custom_rsync_path_local_darwin="/usr/local/bin/rsync_v3" - - + + # Override local system checks (YES/NO) #check_local_system="NO" # (Bypasses the local system checks) @@ -267,13 +267,13 @@ enable_rsync_session_log="NO" ########################### EXPORT-START ############################ -## EXPORT SETTINGS +## EXPORT SETTINGS export backupConfigurationVersion export sshRemoteUser export sshRemoteServer export hardware_address export sendGrowlNotification -export WAKE +export WAKE export SLEEP export backupDest export log_fileName diff --git a/etc/lbackup/example_backup_config/example_mail.conf b/etc/lbackup/example_backup_config/example_mail.conf index f0678a6..80e03eb 100755 --- a/etc/lbackup/example_backup_config/example_mail.conf +++ b/etc/lbackup/example_backup_config/example_mail.conf @@ -17,23 +17,23 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## http://www.lbackup.org ## ## ## ## ## -################################################## +################################################## -################################################## +################################################## ## ## -## The origional developer of this software ## +## The origional developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## http://www.lucidsystems.org ## ## ## -################################################## +################################################## ################################################## # # This is a configuration file for the Mail -# component of the lbackup system. This is a +# component of the lbackup system. This is a # configuration file for the lmail component. # This script should be called as listed below. # eg . /usr/local/sbin/lmail /path/to/this/script.conf @@ -72,7 +72,7 @@ sshUser="mail" sshServer="192.168.0.1" # Backup Report Identifier - String included in the body of report -backup_identity="Important Files From The Office Server - DAILY" +backup_identity="Important Files From The Office Server - DAILY" # Log File Archive logFileArchive_name="log_archive" @@ -80,7 +80,7 @@ logFileArchive_name="log_archive" # Search for custom mail templates directory "message_templates" and files. # This feature is experimental and may be altered or removed in a future -# release. Finally, enabling this feature has the potential to +# release. Finally, enabling this feature has the potential to # significantly reduce the reliability of email reporting. enableCustomMailTemplates="NO" @@ -108,13 +108,13 @@ mail_post_action_script="" ########################## EXPORT-START ############################# -## EXPORT SETTINGS +## EXPORT SETTINGS export mailConfigurationVersion export messageRecipient export messageFromName export messageFromAddress export logFile_name -export mailsystem +export mailsystem export sshUser export sshServer export backup_identity diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/backup.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/backup.bash index 35f53e2..9db36b4 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/backup.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/backup.bash @@ -20,12 +20,12 @@ ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/mount_volume_ssh.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/mount_volume_ssh.bash index 3668b7b..b9f0e24 100644 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/mount_volume_ssh.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/mount_volume_ssh.bash @@ -14,7 +14,7 @@ # Description # -# Mounts a remote area via SFTP +# Mounts a remote area via SFTP # Desinged for backup purposes # Requires MacFuse and SSHFS # @@ -39,7 +39,7 @@ mount_point="/Volumes/${volume_name}" alternate_backup_device="/Volumes/BigDisk" -# Internal Varibles : +# Internal Varibles : SSHFS=/usr/local/bin/sshfs mount_point_created="NO" @@ -67,7 +67,7 @@ check_for_local_backup_devices # Mount some SFTP points mounting with FUSE! -if ! [ -d ${mount_point} ] ; then +if ! [ -d ${mount_point} ] ; then # Create the mount point mkdir ${mount_point} @@ -77,7 +77,7 @@ if ! [ -d ${mount_point} ] ; then else mount_point_created="YES" fi - + # connect to the mount point using SSHFS $SSHFS ${ssh_user_name}@${ssh_server}:${ssh_remote_directory} ${mount_point} -oreconnect,ping_diskarb,volname=${volume_name} if [ $? != 0 ] ; then @@ -88,7 +88,7 @@ if ! [ -d ${mount_point} ] ; then fi fi echo " ERROR! : Mounting via SSH" | tee -ai $logFile - exit -1 + exit -1 fi sleep 25 else diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/start_backup.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/start_backup.bash index b6bd16b..06fca91 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/start_backup.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/additional-scripts/start_backup/start_backup.bash @@ -20,12 +20,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # @@ -34,7 +34,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Even if you are not an administrator, it will prompt for # administrator privilige elveation. # -# +# # Note : This Script Requires Mac OS 10.4 or later # @@ -61,7 +61,7 @@ apple_script_command="return do shell script \"sudo ${path_to_backup_application ############################### # Check the Volume is Mounted -if [ -f "${path_to_backup_application}" ] && [ -f "${path_to_backup_script}" ]; then +if [ -f "${path_to_backup_application}" ] && [ -f "${path_to_backup_script}" ]; then # Open Log File if [ "${path_to_log_file}" != "" ] ; then @@ -70,7 +70,7 @@ if [ -f "${path_to_backup_application}" ] && [ -f "${path_to_backup_script}" ]; # Start the Backup echo "`date` : Starting Backup..." - + if [ "`whoami`" != "root" ] ; then osascript -e "${apple_script_command}" else @@ -78,10 +78,10 @@ if [ -f "${path_to_backup_application}" ] && [ -f "${path_to_backup_script}" ]; fi else - + # Report Error echo "ERROR! : Unable to Find Backup Script or Backup Configuration" - + fi exit 0 diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-200-Generate-Link-To-Backup-Destination-Directory.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-200-Generate-Link-To-Backup-Destination-Directory.bash index 0955c32..0be2f44 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-200-Generate-Link-To-Backup-Destination-Directory.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-200-Generate-Link-To-Backup-Destination-Directory.bash @@ -16,18 +16,18 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## http://www.lucidsystems.org ## ## ## -################################################### +################################################### # # This script may be used to mainain a link from the to the # backup configuration directory to the backup destination -# directory. +# directory. # # # This script requires lbackup version 0.9.8.r2 or later @@ -63,12 +63,12 @@ function preflight_checks { # Check the destination exits if [ -d "${new_link_destination}" ] ; then link_destination_exists="YES" - + # Check to see if there is already an exiting link if [ -L "${automatic_link_to_backup_set}" ] ; then previous_link_exits="YES" fi - + # If there is an exiting link then check to see if it should be updated if [ "${previous_link_exits}" == "YES" ] ; then current_link_destination=`ls -l "${automatic_link_to_backup_set}" | awk -F " -> " '{print $2}'` @@ -76,29 +76,29 @@ function preflight_checks { link_requires_update="NO" fi fi - + else - # There is no backup directory currently availible. + # There is no backup directory currently availible. # Just report the fact and carry on with any other enabled the post action scripts echo " WARNING! : Unable to generate link to backup directory." | tee -ai $logFile echo " Backup destination directory was not available : " | tee -ai $logFile echo " ${new_link_destination}" | tee -ai $logFile - exit ${SCRIPT_WARNING} + exit ${SCRIPT_WARNING} fi # if you need to debug something just uncommnet the lines below : - + # echo "Previous Link Exits : ${previous_link_exits}" # echo "Link Requires Update : ${link_requires_update}" # echo " link dest : ${current_link_destination}" # echo " link file : ${automatic_link_to_backup_set}" # echo " new dest : ${new_link_destination}" - + } -function create_link { - +function create_link { + if ! [ -e "${automatic_link_to_backup_set}" ] ; then ln -s "${new_link_destination}" "${automatic_link_to_backup_set}" if [ $? != 0 ] ; then @@ -116,8 +116,8 @@ function delete_link { if [ -L "${automatic_link_to_backup_set}" ] ; then rm -f "${automatic_link_to_backup_set}" if [ $? != 0 ] ; then - echo " WARNING! : Unable to remove the previous automatic link to the backup set." | tee -ai $logFile - echo " The link to the backup destination will not be updated : " | tee -ai $logFile + echo " WARNING! : Unable to remove the previous automatic link to the backup set." | tee -ai $logFile + echo " The link to the backup destination will not be updated : " | tee -ai $logFile echo " ${automatic_link_to_backup_set}" | tee -ai $logFile exit ${SCRIPT_WARNING} fi @@ -141,5 +141,5 @@ fi exit ${SCRIPT_SUCCESS} - + diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-210-Generate-Link-To-Backup-Configuration-Directory.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-210-Generate-Link-To-Backup-Configuration-Directory.bash index b547cb9..17d9167 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-210-Generate-Link-To-Backup-Configuration-Directory.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-210-Generate-Link-To-Backup-Configuration-Directory.bash @@ -16,16 +16,16 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## http://www.lucidsystems.org ## ## ## -################################################## +################################################## # -# This script may be used to mainain a link from the to the backup +# This script may be used to mainain a link from the to the backup # destination directory to the backup configuration directory. # # @@ -58,19 +58,19 @@ current_link_destination="" function preflight_checks { - + # Check the source directory exists if [ -d "${new_link_destination}" ] ; then - + # Check the destination exits if [ -d "${backupDest}" ] ; then link_destination_exists="YES" - + # Check to see if there is already an exiting link if [ -L "${automatic_link_to_backup_configuration_directory}" ] ; then previous_link_exits="YES" fi - + # If there is an exiting link then check to see if it should be updated if [ "${previous_link_exits}" == "YES" ] ; then current_link_destination=`ls -l "${automatic_link_to_backup_configuration_directory}" | awk -F " -> " '{print $2}'` @@ -78,39 +78,39 @@ function preflight_checks { link_requires_update="NO" fi fi - + else - # There is no backup directory currently availible. + # There is no backup directory currently availible. # Just report the fact and carry on with any other enabled the post action scripts echo " WARNING! : Unable to generate link to backup directory." | tee -ai $logFile echo " Backup destination directory was not available : " | tee -ai $logFile echo " ${new_link_destination}" | tee -ai $logFile - exit ${SCRIPT_WARNING} + exit ${SCRIPT_WARNING} fi - + else - # There is no backup configuration directory availible. + # There is no backup configuration directory availible. # Just report the fact and carry on with any other enabled the post action scripts echo " WARNING! : Unable to generate link to backup configuration directory." | tee -ai $logFile echo " Backup configruation directory was not available : " | tee -ai $logFile echo " ${new_link_destination}" | tee -ai $logFile - exit ${SCRIPT_WARNING} + exit ${SCRIPT_WARNING} fi - + # if you need to debug something just uncommnet the lines below : - + # echo "Previous Link Exits : ${previous_link_exits}" # echo "Link Requires Update : ${link_requires_update}" # echo " link dest : ${current_link_destination}" # echo " link file : ${automatic_link_to_backup_configuration_directory}" # echo " new dest : ${new_link_destination}" - + } -function create_link { - +function create_link { + if ! [ -e "${automatic_link_to_backup_configuration_directory}" ] ; then ln -s "${new_link_destination}" "${automatic_link_to_backup_configuration_directory}" if [ $? != 0 ] ; then @@ -128,8 +128,8 @@ function delete_link { if [ -L "${automatic_link_to_backup_configuration_directory}" ] ; then rm -f "${automatic_link_to_backup_configuration_directory}" if [ $? != 0 ] ; then - echo " WARNING! : Unable to remove the previous automatic link to the backup configuration directory." | tee -ai $logFile - echo " The link to the backup configuration will not be updated : " | tee -ai $logFile + echo " WARNING! : Unable to remove the previous automatic link to the backup configuration directory." | tee -ai $logFile + echo " The link to the backup configuration will not be updated : " | tee -ai $logFile echo " ${automatic_link_to_backup_configuration_directory}" | tee -ai $logFile exit ${SCRIPT_WARNING} fi @@ -153,5 +153,5 @@ fi exit ${SCRIPT_SUCCESS} - + diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-300-Generate-Time-Based-Backup-Links-Directory.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-300-Generate-Time-Based-Backup-Links-Directory.bash index ebcd281..efee22d 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-300-Generate-Time-Based-Backup-Links-Directory.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-300-Generate-Time-Based-Backup-Links-Directory.bash @@ -16,18 +16,18 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## http://www.lucidsystems.org ## ## ## -################################################## +################################################## # -# This script may be used to manage a directory with +# This script may be used to manage a directory with # links to backup snap shots. The titles of the links -# are set to the date and time when the backup runs. +# are set to the date and time when the backup runs. # # # This script requires lbackup version 0.9.8.r2 or later @@ -44,7 +44,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Name of the directory we where put the links links_directory_name="snapshot_links_by_backup_time" -# Kind of links ("relative" is reccomended), ("absolute" is a possibilty) +# Kind of links ("relative" is reccomended), ("absolute" is a possibilty) link_sytle="relative" @@ -64,12 +64,12 @@ function preflight_checks { if [ -d ${links_directory_path} ] ; then links_directory_exists="YES" fi - + if [ "${backup_status}" != "SUCCESS" ] ; then echo " WARNING! : No time based backup links will be generated because the backup has not succeeded." | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + } @@ -80,16 +80,16 @@ function generate_links_directory { echo " ERROR! : Unable to generate links directory" | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + } function update_old_links { - for symbolic_time_based_link in "$links_directory_path"/* + for symbolic_time_based_link in "$links_directory_path"/* do - if [ -L "$symbolic_time_based_link" ] ; then + if [ -L "$symbolic_time_based_link" ] ; then # Calculate some information about this symbolic link link_name=`basename "$symbolic_time_based_link"` @@ -98,38 +98,38 @@ function update_old_links { # If this is not a link to a section then skip this symbolic link. if [ "$current_section_number" != "" ]; then - + # Perform some additional calculations on this link. # new_section_number=`echo "$current_section_number + 1" | bc` new_section_number=$(expr $current_section_number + 1) new_link_name="Section.$new_section_number" - + if [ "${link_sytle}" == "absolute" ] ; then new_link_destination="${backupDest}/${new_link_name}" else new_link_destination="../${new_link_name}" - # we are working in a relative way, so it is essential + # we are working in a relative way, so it is essential # that we switch into the appropriate directory and work relatively. cd "${links_directory_path}" fi - - # Check the new link destination exists + + # Check the new link destination exists if ! [ -d "$new_link_destination" ] ; then # Old backup snapshot which has been deleted, so we delete the link. rm "$symbolic_time_based_link" if [ $? != 0 ] ; then echo " ERROR! : Removing outdated link failed." | tee -ai $logFile - exit ${SCRIPT_WARNING} + exit ${SCRIPT_WARNING} fi else ln -s "$new_link_destination" "${symbolic_time_based_link}.tmp" if [ $? == 0 ] ; then rm -f "${symbolic_time_based_link}" - if [ $? == 0 ] ; then + if [ $? == 0 ] ; then mv -i "${symbolic_time_based_link}.tmp" "$symbolic_time_based_link" if [ $? != 0 ] ; then echo " ERROR! : Moving temporary symbolic link into place." | tee -ai $logFile - exit ${SCRIPT_WARNING} + exit ${SCRIPT_WARNING} fi else echo " ERROR! : Deleting old link : ${new_link_destination}" | tee -ai $logFile @@ -139,10 +139,10 @@ function update_old_links { echo " ERROR! : Generating Time Based Backup Link" | tee -ai $logFile exit ${SCRIPT_WARNING} fi - fi + fi fi fi - + done } @@ -158,7 +158,7 @@ function add_link_for_this_backup { cd "${links_directory_path}" ln -s "../Section.0" "$symbolic_link_name" fi - + if [ $? != 0 ] ; then echo " ERROR! : Unable to generate link to the latest backup" | tee -ai $logFile exit ${SCRIPT_WARNING} @@ -184,5 +184,5 @@ add_link_for_this_backup exit ${SCRIPT_SUCCESS} - + diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-500-EjectDiskImage.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-500-EjectDiskImage.bash index 9da39df..b2bcae9 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-500-EjectDiskImage.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-500-EjectDiskImage.bash @@ -16,21 +16,21 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # -# This is a simple script which will use the finder +# This is a simple script which will use the finder # to eject the specified disk. This script requires -# applescript and will also require a user to be +# applescript and will also require a user to be # logged in, as it is making a call using appplescript # to preform the unmount. -# +# # Note : This Script Requires Mac OS 10.4 or later # Possibly worth while adding a function which supports other # eject / unmount meathods. This would make the script @@ -50,26 +50,26 @@ exit_value=${SCRIPT_SUCCESS} eject_meathod="osascript" function unmount_volumes { - - + + ################################ #### INTERNAL VARIABLES ### ################################ - + # Set the apple script command apple_script_command='tell application "Finder" to eject disk "'${volume_to_unmount}'"' - - + + ############################### #### PERFORM ACTION ### ############################### - + # Check the Volume is Mounted - if [ -d "/Volumes/${volume_to_unmount}" ] ; then - + if [ -d "/Volumes/${volume_to_unmount}" ] ; then + # Eject the mounted volume echo " Ejecting Backup Disk Image..." | tee -ai $logFile - + if [ "${eject_meathod}" == "osascript" ] ; then # Use apple script to eject the disk image osascript -e "${apple_script_command}" | tee -ai $logFile @@ -85,11 +85,11 @@ function unmount_volumes { exit ${hdiutil_exit} fi fi - + # Check the volume was ejected sleep 5 sync - if [ -d "/Volumes/${volume_to_unmount}" ] ; then + if [ -d "/Volumes/${volume_to_unmount}" ] ; then echo " Unable to Eject Backup Volume : /Volumes/${volume_to_unmount}" | tee -ai $logFile exit_value=${SCRIPT_WARNING} # Uncomment line below to prevent other disks from being ejected. @@ -97,15 +97,15 @@ function unmount_volumes { else echo " Volume Ejected : /Volumes/${volume_to_unmount}" | tee -ai $logFile fi - + else - + if [ "${volume_to_unmount}" != "$ssh_mountpoint" ] ; then # Report that the volume was not mounted echo " Backup Volume Not Mounted : Unable to Eject : ${volume_to_unmount}" | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + fi } @@ -127,7 +127,7 @@ sleep 15 #sleep 15 #ssh_mountpoint="backup_mount_ssh" # Only applies to the SSH mountpoint -#volume_to_unmount="$ssh_mountpoint" +#volume_to_unmount="$ssh_mountpoint" #unmount_volumes diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-600-UnMountBackupVolume.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-600-UnMountBackupVolume.bash index 7aef2b9..b95aac0 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-600-UnMountBackupVolume.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-600-UnMountBackupVolume.bash @@ -16,20 +16,20 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # -# This is a simple script which will use the diskutil -# to unmount the specified volume. +# This is a simple script which will use the diskutil +# to unmount the specified volume. # # Keep in mind that some devices have more than one volume. -# +# # Note : This Script Requires Mac OS 10.4 or later # @@ -44,16 +44,16 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin unmounted_volume="NO" function unmount_volumes { - - - + + + ############################### #### PERFORM ACTION ### ############################### - + # Check the Volume is Mounted - if [ -d "/Volumes/${volume_to_unmount}" ] ; then - + if [ -d "/Volumes/${volume_to_unmount}" ] ; then + # Unmount the mounted volume echo " Unmounting Backup Volume..." | tee -ai $logFile diskutil unmount "/Volumes/${volume_to_unmount}" | sed s'/^/ /' | tee -ai $logFile @@ -64,7 +64,7 @@ function unmount_volumes { else unmounted_volume="YES" fi - + else # Report that the volume was not mounted echo " Backup Volume Not Mounted : ${volume_to_unmount}" | tee -ai $logFile @@ -84,12 +84,12 @@ function unmount_volumes { # This example will only report if no volumes were found to unmount. Alter the section below to change this behavior volume_to_unmount="Backup1" -if [ -d "/Volumes/${volume_to_unmount}" ] ; then +if [ -d "/Volumes/${volume_to_unmount}" ] ; then unmount_volumes fi volume_to_unmount="Backup2" -if [ -d "/Volumes/${volume_to_unmount}" ] ; then +if [ -d "/Volumes/${volume_to_unmount}" ] ; then unmount_volumes fi @@ -110,5 +110,5 @@ else exit ${SCRIPT_WARNING} fi - + diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-700-Sync-Sparse-Image-to-Remote-Server.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-700-Sync-Sparse-Image-to-Remote-Server.bash index 82b6f5c..da8747b 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-700-Sync-Sparse-Image-to-Remote-Server.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-700-Sync-Sparse-Image-to-Remote-Server.bash @@ -16,32 +16,32 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -###################################################### +###################################################### # This script will use rsync to push an updated copy of a sparse bundle image -# from the local machine to a remote machine. -# +# from the local machine to a remote machine. +# # This script could easily be modified to pull the backup or move the backup between two servers. # # This script is also easily condensable into a single line so it can be added concisely to your .profile # for easy execution. # -# The script will display progress of each band being copied or deleted during the copy. To disable this +# The script will display progress of each band being copied or deleted during the copy. To disable this # remove the --progress option when calling rsync. -# +# # If you are syncing arcross a link then you will probably want to alter some of the settings. # # Finally, IT IS VERY IMPORTANT that before you call this script you check the disk image is not mounted. # In addition, this script has only been tested between Mac OS X systems. Use it on other operating systems # at your own risk. -# +# # Do not add spaces etc into any paths. This script will probably break. @@ -73,7 +73,7 @@ local_system_kind="" remote_system_kind="" export_ssh_agent_command_with_colon="" -# Preflight Checks +# Preflight Checks if [ "${backup_status}" != "SUCCESS" ] ; then echo " WARNING! : Sparse image synchronization will not continue because the backup has not succeeded." | tee -ai $logFile exit ${SCRIPT_WARNING} @@ -132,7 +132,7 @@ fi # Okay now we have all the configuration information lets copy / update the sparse bundle. # Check the image available and is not mounted. -if [ -d "${local_sparse_bundle_to_sync}" ] && [ "${hdiutil_mounted_status}" == "" ] ; then +if [ -d "${local_sparse_bundle_to_sync}" ] && [ "${hdiutil_mounted_status}" == "" ] ; then # Print some volume statistics for the remote servers root partition. echo " Remote server disk usage statistics for : $remote_server_address "| tee -ai $logFile @@ -147,16 +147,16 @@ if [ -d "${local_sparse_bundle_to_sync}" ] && [ "${hdiutil_mounted_status}" == " # Use rsync to copy / update the remote file echo " Syncing disk image to remote server..." | tee -ai $logFile - + if [ "${remote_system_kind}" == "Darwin" ] ; then # Command if remote system is Darwin (with rsync patch) export rsync_command="${path_to_rsync} --rsync-path=${remote_path_to_rsync} -aNHAXEx --delete --protect-args --fileflags --force-change ${local_sparse_bundle_to_sync} ${remote_server_user}@${remote_server_address}:${remote_sparse_bundle_destination}" fi - + if [ "${remote_system_kind}" == "Linux" ] ; then # Command if remote system is Linux - #rsync_command="${path_to_rsync} --rsync-path=${remote_path_to_rsync} -aHAEx --delete \"${local_sparse_bundle_to_sync}\" ${remote_server_user}@${remote_server_address}:${remote_sparse_bundle_destination} 2>&1 | sed s'/^/ /' | tee -ai ${logFile}" - export rsync_command="${path_to_rsync} --rsync-path=${remote_path_to_rsync} -aHAEx --delete ${local_sparse_bundle_to_sync} ${remote_server_user}@${remote_server_address}:${remote_sparse_bundle_destination}" + #rsync_command="${path_to_rsync} --rsync-path=${remote_path_to_rsync} -aHAEx --delete \"${local_sparse_bundle_to_sync}\" ${remote_server_user}@${remote_server_address}:${remote_sparse_bundle_destination} 2>&1 | sed s'/^/ /' | tee -ai ${logFile}" + export rsync_command="${path_to_rsync} --rsync-path=${remote_path_to_rsync} -aHAEx --delete ${local_sparse_bundle_to_sync} ${remote_server_user}@${remote_server_address}:${remote_sparse_bundle_destination}" #${path_to_rsync} --rsync-path=${remote_path_to_rsync} -aHAEx --delete "${local_sparse_bundle_to_sync}" ${remote_server_user}@${remote_server_address}:${remote_sparse_bundle_destination} 2>&1 | sed s'/^/ /' | tee -ai ${logFile} fi @@ -164,7 +164,7 @@ if [ -d "${local_sparse_bundle_to_sync}" ] && [ "${hdiutil_mounted_status}" == " echo " WARNING! : No rsync command specified for this of remote operating system : ${remote_system_kind}" | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + if [ "${run_sync_as}" == "" ] ; then ${rsync_command} 2>&1 | sed s'/^/ /' | sed s'/^/ /' | tee -ai ${logFile} exit ${PIPESTATUS[0]} @@ -173,7 +173,7 @@ if [ -d "${local_sparse_bundle_to_sync}" ] && [ "${hdiutil_mounted_status}" == " sudo su -l ${run_sync_as} -c "${export_ssh_agent_command_with_colon} ${rsync_command} 2>&1 | sed s'/^/ /' | sed s'/^/ /' | tee -ai ${logFile} ; exit ${PIPESTATUS[0]}" rsync_return_value=$? fi - + if [ $rsync_return_value != 0 ] ; then echo " WARNING! : Occurred during disk image sync." | tee -ai $logFile echo " Rsync Exit Value : $rsync_return_value" | tee -ai $logFile diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-750-Sync-Sparse-Image-to-Locally-Accessible-Directory.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-750-Sync-Sparse-Image-to-Locally-Accessible-Directory.bash index 9db9e27..fd947a4 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-750-Sync-Sparse-Image-to-Locally-Accessible-Directory.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-750-Sync-Sparse-Image-to-Locally-Accessible-Directory.bash @@ -3,13 +3,13 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Copyright 2011 Henri Shustak # Released Under The GNU GPL v3 -# Lucid Information Systems +# Lucid Information Systems # http://www.lucidsystems.org # # # This script will use rsync to push an updated copy of a sparse bundle image # from the local machine to a remote machine which is accessible from a network mount. -# It is also possible to use this script to keep an additional copy of your sparse bundle +# It is also possible to use this script to keep an additional copy of your sparse bundle # on the local system in sync. # # @@ -31,7 +31,7 @@ rsync_command="" hdiutil_mounted_status="" local_system_kind="" -# Preflight Checks +# Preflight Checks if [ "${backup_status}" != "SUCCESS" ] ; then echo " WARNING! : Sparse image synchronization will not continue because the backup has not succeeded." | tee -ai $logFile exit ${SCRIPT_WARNING} @@ -44,7 +44,7 @@ local_system_kind=`uname` # Check this system is Mac OS X and that the destination is availible. if [ "${local_system_kind}" == "Darwin" ] ; then # Test backup destination directory is availible - if ! [ -d "${local_sparse_bundle_destination_dir}" ] ; then + if ! [ -d "${local_sparse_bundle_destination_dir}" ] ; then echo " WARNING! : The sparse bundle destination directory is not available." | tee -ai $logFile exit ${SCRIPT_WARNING} fi @@ -57,7 +57,7 @@ fi # Okay now we have all the configuration information lets copy / update the sparse bundle. # Check the image available and is not mounted. -if [ -d "${local_sparse_bundle_to_sync}" ] && [ "${hdiutil_mounted_status}" == "" ] ; then +if [ -d "${local_sparse_bundle_to_sync}" ] && [ "${hdiutil_mounted_status}" == "" ] ; then # Use rsync to copy / update the remote file echo " Syncing the sparse bundle image..." | tee -ai $logFile ${path_to_rsync} -aNHAXEx --delete --protect-args --fileflags --force-change "${local_sparse_bundle_to_sync}" "${local_sparse_bundle_destination_dir}" 2>&1 | sed s'/^/ /' | tee -ai ${logFile} diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-800-ArchiveRsyncSessionLog.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-800-ArchiveRsyncSessionLog.bash index 7b04374..8a5dc0d 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-800-ArchiveRsyncSessionLog.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-800-ArchiveRsyncSessionLog.bash @@ -16,18 +16,18 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## http://www.lucidsystems.org ## ## ## -################################################## +################################################## # # This script will copy the rsync_session_log # into an archvie folder with the date appended -# to the name of the session log. +# to the name of the session log. # # This script will not remove the session log after # copying to the archive directory. @@ -77,17 +77,17 @@ function preflight_checks { echo "" | tee -ai $logFile exit ${SCRIPT_WARNING} fi - - + + if [ -d ${log_archive_folder_absolute} ] ; then log_archive_folder_exits="YES" fi - + if [ "${backupConfigurationFolderPath}" == "" ] ; then echo " WARNING! : backupConfigurationFolderPath variable was not set." | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + if [ "${rsync_session_log_name}" == "" ] ; then echo " WARNING! : rsync_session_log_name variable was not set." | tee -ai $logFile exit ${SCRIPT_WARNING} @@ -97,13 +97,13 @@ function preflight_checks { echo " WARNING! : Backup configuration directory is not available, rsync session log archiving canceled." | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + if [ "${backup_status}" != "SUCCESS" ] ; then # You can remove this if you want the rsync log session log to be archived regardeless of the backup status. echo " WARNING! : Backup was not successful, rsync session log will not be archived." | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + } @@ -118,24 +118,24 @@ function generate_rsync_session_log_archive_directory { echo " WARNING! : Unable to generate rsync session log archive directory" | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + } function archive_rsync_session_log { - + current_date=`date "+%Y-%m-%d_@%H-%M-%S"` rsync_session_log_destination_name="rsync_session_log_${current_date}.log" rsync_session_log_destination_absolute="${log_archive_folder_absolute}/${rsync_session_log_destination_name}" - + # Check there is no file already archived if [ -f "${rsync_session_log_destination_absolute}" ] ; then echo " WARNING! : rsync session log with name already exists in archive directory." | tee -ai $logFile echo " ${rsync_session_log_destination_absolute}" | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + # Copy that log. cp "${rsync_session_log_absolute}" "${rsync_session_log_destination_absolute}" if [ $? != 0 ] ; then @@ -144,11 +144,11 @@ function archive_rsync_session_log { echo " destination file : ${rsync_session_log_destination_absolute}" | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + } function remove_old_rsync_session_logs { - + # Check this directory actually exists if ! [ -d "${log_archive_folder_absolute}" ] ; then echo " WARNING! : Unable to locate the rsync session log archive directory." | tee -ai $logFile @@ -162,7 +162,7 @@ function remove_old_rsync_session_logs { rsync_session_log_array=(`ls -t "${log_archive_folder_absolute}" | grep "${rsync_session_log_name}"`) # Check that there are some rsync session log archives - number_of_archived_session_logs=`echo ${#rsync_session_log_array[@]}` + number_of_archived_session_logs=`echo ${#rsync_session_log_array[@]}` if [ $number_of_archived_session_logs == 0 ] ; then echo " NOTICE! : No archived logs located in the rsync log archive directory." | tee -ai $logFile echo " ${log_archive_folder_absolute}" | tee -ai $logFile @@ -172,7 +172,7 @@ function remove_old_rsync_session_logs { # Check to see if there are more archived rsync session logs than there are rotations in this configuation # The number of rotations is accruate - even though the access to the array starts at zero if [ ${number_of_archived_session_logs} -gt ${numRotations} ] ; then - # Okay so we need to remove some of these archives + # Okay so we need to remove some of these archives # Lets calculate some indexes first to work out between which two points we are removing items. number_of_archived_session_logs_minus_one=${number_of_archived_session_logs} @@ -185,7 +185,7 @@ function remove_old_rsync_session_logs { rsync_session_log_filename_to_remove="${rsync_session_log_array[${current_removal_point_in_array}]}" rsync_session_log_absolute_path_to_file_to_remove="${log_archive_folder_absolute}/${rsync_session_log_filename_to_remove}" - + if [ -f "${rsync_session_log_absolute_path_to_file_to_remove}" ] ; then #echo "rsync_session_log_absolute_path_to_file_to_remove : ${rsync_session_log_absolute_path_to_file_to_remove}" | tee -ai $logFile rm -f "${rsync_session_log_absolute_path_to_file_to_remove}" @@ -197,7 +197,7 @@ function remove_old_rsync_session_logs { fi ((current_removal_point_in_array++)) done - + fi } diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-950-ReportDiskUsageDifference.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-950-ReportDiskUsageDifference.bash index f32095a..bde366e 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-950-ReportDiskUsageDifference.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-950-ReportDiskUsageDifference.bash @@ -16,7 +16,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## http://www.lucidsystems.org ## @@ -24,14 +24,14 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## Part of the LBackup project ## ## http://www.lbackup.org ## ## ## -################################################## +################################################## # # If the backup was successfull then the differnece # in disk usage between this most recent backup and # the previous backup will be reported in megabytes -# +# # # # This script requires lbackup version 0.9.8.r2 or later @@ -44,7 +44,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # This example script utilzies the 'bc' and 'du' commands for various calculations # This script will not work correctly if the 'bc' or the 'du' commands are not availible # -# Next revision of this script will add options for reporting the differences by +# Next revision of this script will add options for reporting the differences by # the backup log files for details reported by LBackup. This information may # be different from the actual disk utilization as reported by the 'du' command. @@ -77,30 +77,30 @@ function preflight_checks { # Check the backup set exits if [ -d "${backup_set_directory}" ] ; then backup_set_directory_exists="YES" - + # Check to see if there most recent backup exists if [ -d "${first_most_recent_backup_snapshot_path}" ] ; then first_most_recent_exits="YES" fi - + # Check to see if there most recent backup exists if [ -d "${second_most_recent_backup_snapshot_path}" ] ; then second_most_recent_exits="YES" fi - + else # Just report the fact and carry on with any other enabled the post action scripts echo " WARNING! : Unable to calculate the size of the backup." | tee -ai $logFile echo " Backup destination directory was not available : " | tee -ai $logFile echo " ${new_link_destination}" | tee -ai $logFile - exit ${SCRIPT_WARNING} + exit ${SCRIPT_WARNING} fi - + } function calculate_snapshot_size_in_megabytes { - + if [ -e "${directory_for_disk_usage_calculation_path}" ] ; then kilobytes_used=`du -sk "${directory_for_disk_usage_calculation_path}" | awk '{print $1}'` # change the way we report depending upon if the total is more or less than 10MB in total @@ -118,19 +118,19 @@ function calculate_snapshot_size_in_megabytes { echo " $directory_for_disk_usage_calculation_path" | tee -ai $logFile exit ${SCRIPT_WARNING} fi - + # Not able to return floting point numbers. Therefore setting this varible is important. Better ideas for doin this in BASH are welcome. directory_for_disk_usage_calculation_size="$megabytes_used" } function calculate_differnece_in_snapshot_size_in_megabytes { - + difference_between_snapshots=`echo "${first_most_recent_backup_snapshot_disk_usage} - ${second_most_recent_backup_snapshot_disk_usage}" | bc` positive_difference=`echo "${difference_between_snapshots} > 0" | bc` backup_snapshots_same_size=`echo "${first_most_recent_backup_snapshot_disk_usage} == ${second_most_recent_backup_snapshot_disk_usage}" | bc` difference_between_snapshots_multiplied_by_negitive_one=`echo "${difference_between_snapshots} * -1" | bc` - + } @@ -164,7 +164,7 @@ fi if [ ${backup_snapshots_same_size} == 1 ] ; then echo " The previous and the most recently completed snapshots share approximately the same disk utilization." else - if [ $positive_difference == 1 ] ; then + if [ $positive_difference == 1 ] ; then echo " Compared with the previous snapshot approximately ${difference_between_snapshots} MB of additional disk usage is required." | tee -ai $logFile else echo " This snapshot disk usage is approximately ${difference_between_snapshots_multiplied_by_negitive_one} MB smaller than the previous backup." | tee -ai $logFile diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-990-ReportCompletionTime.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-990-ReportCompletionTime.bash index 9417311..5682453 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-990-ReportCompletionTime.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/post-actions/BACKUP-990-ReportCompletionTime.bash @@ -16,12 +16,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## http://www.lucidsystems.org ## ## ## -################################################## +################################################## # # This script is part of the LBackup project. @@ -29,7 +29,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Related Page : https://connect.homeunix.com/lbackup/example_scripts # - + time_and_date=`date` echo " Backup Completed : ${time_and_date}" | tee -ai $logFile diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-075-CheckBackupDestinationDirecotyAvailible.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-075-CheckBackupDestinationDirecotyAvailible.bash index 9e4e5c1..f8057ac 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-075-CheckBackupDestinationDirecotyAvailible.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-075-CheckBackupDestinationDirecotyAvailible.bash @@ -22,7 +22,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## @@ -50,9 +50,9 @@ if ! [ -d "${backupDest}" ] ; then echo " ERROR! : Unable to locate the backup destination directory :" | tee -ai $logFile echo " $backupDest" | tee -ai $logFile exit ${SCRIPT_HALT} -else +else exit ${SCRIPT_SUCCESS} -fi +fi diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-100-BasicMountDiskImage.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-100-BasicMountDiskImage.bash index 8a2962c..b3e3f51 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-100-BasicMountDiskImage.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-100-BasicMountDiskImage.bash @@ -16,16 +16,16 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licenced under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # -# This is a script which mounts a disk image volume +# This is a script which mounts a disk image volume # # Note : If you are using rotating backups then make # sure you set the permissions on the image @@ -80,12 +80,12 @@ function perform_backup { fi # Check a Image Volume is Mounted for a Second Time - if [ "$dfResult" != "" ] ; then + if [ "$dfResult" != "" ] ; then echo " Backup Image Volume Available" | tee -ai $logFile # Exit and Continue With Other Scripts exit ${SCRIPT_SUCCESS} - + else # Report that Backup Image Volume is Unavialible and that backup should be aborted. echo " Unable to Mount Encrypted Volume" | tee -ai $logFile @@ -96,13 +96,13 @@ function perform_backup { # Check backupVolume is availible dfResult=`df | grep $backupVolume` -if [ "$dfResult" != "" ] ; then +if [ "$dfResult" != "" ] ; then echo " Backup Volume Available" | tee -ai $logFile perform_backup -else +else echo " Unable to Detect Backup Drive" | tee -ai $logFile exit ${SCRIPT_HALT} fi - + exit 0 diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-100-MountDiskImage.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-100-MountDiskImage.bash index ba779c8..9591a4a 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-100-MountDiskImage.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-100-MountDiskImage.bash @@ -16,16 +16,16 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licenced under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # -# This is a script which mounts a disk image volume +# This is a script which mounts a disk image volume # # Note : If you are using rotating backups then make # sure you set the permissions on the image @@ -68,7 +68,7 @@ imageVolumeLocation3="/Volumes/BackupDrive3/backupimage.sparseimage" imageVolumeLocation4="/Volumes/BackupDrive4/backupimage.sparseimage" -# Mount image as +# Mount image as user2mount=myusername @@ -85,32 +85,32 @@ function perform_backup { if [ "$dfResult" == "" ] ; then # Image volume is not currently mounted, attempt to mount echo " Mounting Backup Image Volume..." | tee -ai $logFile - + # Mount the disk image - + ## Mount with verification - Good for manual backup (you can skip it manually this is a good meathod use this if possible.) su -l ${user2mount} -c "open ${imageVolumeLocation}" - + ## Mount with no verification (faster backup start for images residing on network - may have issues on 10.6.x and greater) #su -l ${user2mount} -c "hdiutil attach ${imageVolumeLocation} -noverify" - - + + sleep 30 dfResult=`df | grep $imageVolumeName` fi # Check a Image Volume is Mounted for a Second Time - if [ "$dfResult" != "" ] ; then + if [ "$dfResult" != "" ] ; then echo " Backup Image Volume Available" | tee -ai $logFile # Exit and Continue With Other Scripts exit ${SCRIPT_SUCCESS} - + else # Report that Backup Image Volume is Unavialible and that backup should be aborted. echo " Unable to Mount Encrypted Volume" | tee -ai $logFile exit ${SCRIPT_HALT} - + fi } @@ -120,15 +120,15 @@ function perform_backup { # Check backupVolume is availible dfResult=`df | grep $backupVolume` -if [ "$dfResult" != "" ] ; then +if [ "$dfResult" != "" ] ; then echo " Backup Volume Available" | tee -ai $logFile perform_backup -else +else echo " Unable to Detect Primary Backup Drive" | tee -ai $logFile backupVolume="${backupVolume2}" # Check backupVolume is availible dfResult=`df | grep $backupVolume` - if [ "$dfResult" != "" ] ; then + if [ "$dfResult" != "" ] ; then echo " Secondary Backup Volume Available" | tee -ai $logFile imageVolumeLocation="${imageVolumeLocation2}" perform_backup @@ -137,7 +137,7 @@ else backupVolume="${backupVolume3}" # Check backupVolume is availible dfResult=`df | grep $backupVolume` - if [ "$dfResult" != "" ] ; then + if [ "$dfResult" != "" ] ; then echo " Tertiary Backup Volume Available" | tee -ai $logFile imageVolumeLocation="${imageVolumeLocation3}" perform_backup @@ -146,22 +146,22 @@ else # Check backupVolume is availible backupVolume="${backupVolume4}" dfResult=`df | grep $backupVolume` - if [ "$dfResult" != "" ] ; then + if [ "$dfResult" != "" ] ; then echo " Quaternary Backup Volume Available" | tee -ai $logFile imageVolumeLocation="${imageVolumeLocation4}" perform_backup - else + else echo " Unable to Detect Quaternary Backup Drive" | tee -ai $logFile exit ${SCRIPT_HALT} - fi + fi fi fi fi - + # Quinary = 5 -# Quaternary = 4 - - +# Quaternary = 4 + + exit 0 diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-101-ClearRsyncSessionLog.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-101-ClearRsyncSessionLog.bash index 28aff3b..3370f78 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-101-ClearRsyncSessionLog.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-101-ClearRsyncSessionLog.bash @@ -16,18 +16,18 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # # This is a script will erase any existing rsync # session log. This log contains output from rsync -# such as the files which have been copied and +# such as the files which have been copied and # also includes statistics. # @@ -49,24 +49,24 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin function clear_rsync_session_log { - + # Checks if the varible has been loaded, this will let us know if it is currently enabled. if [ "${rsync_session_log_file}" != "" ] ; then - + # Cheeks if the referenced file exists in the file system if [ -e "${rsync_session_log_file}" ] ; then - + # Removes the old log file rm -f "${rsync_session_log_file}" - + # If there were any issues removing the rsync session log file then report the error and stop the backup. - if [ $? != 0 ] ; then + if [ $? != 0 ] ; then echo "ERROR! : Unable to remove the file ${rsync_session_log_file}" | tee -ai $logFile exit ${SCRIPT_HALT} fi - + fi - + fi } @@ -79,5 +79,5 @@ function clear_rsync_session_log { clear_rsync_session_log exit ${SCRIPT_SUCCESS} - + exit 0 diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-150-LogSystemDiskUsage.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-150-LogSystemDiskUsage.bash index aa5959f..bd88ed9 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-150-LogSystemDiskUsage.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-150-LogSystemDiskUsage.bash @@ -16,16 +16,16 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## This software is licensed under ## ## the GNU GPL. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions available from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # -# This is a script will provide informaton regarding +# This is a script will provide informaton regarding # the disk usage on the system. # @@ -48,12 +48,12 @@ report_destination_diskusage="YES" function log_system_disk_usage { - - # System Disk Usage + + # System Disk Usage if [ "${report_system_diskusage}" == "YES" ] ; then df -hi | sed s'/^/ /' | tee -ai $logFile fi - + # Source Disk Usage if [ "${report_source_diskusage}" == "YES" ] ; then echo "Backup Source : ${backupSource} " | tee -ai $logFile @@ -62,7 +62,7 @@ function log_system_disk_usage { echo "Source Disk Usage : ${backup_source_disk_usage}" | tee -ai $logFile fi fi - + # Destination Disk Usage if [ "${report_destination_diskusage}" == "YES" ] ; then echo "Backup Destination : ${backupDest} " | tee -ai $logFile @@ -71,9 +71,9 @@ function log_system_disk_usage { echo "Previous Backup Disk Usage : ${previous_backup_disk_usage}" | tee -ai $logFile fi fi - + # You could also do something more involved such as working out how much space is required or just show the appropriate disk usage. - + } @@ -84,5 +84,5 @@ function log_system_disk_usage { log_system_disk_usage exit ${SCRIPT_SUCCESS} - + exit 0 diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-200-CheckBackupDiskUsagePercentage.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-200-CheckBackupDiskUsagePercentage.bash index 479c5c3..843ebe6 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-200-CheckBackupDiskUsagePercentage.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-200-CheckBackupDiskUsagePercentage.bash @@ -22,12 +22,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # This script requires LBackup 0.9.8r5 later. # @@ -36,7 +36,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # # This script is designed to work with OS X systems. # Contributions to make this script work on other platforms is -# welcome : http://www.lbackup.org +# welcome : http://www.lbackup.org ## Configuration @@ -52,7 +52,7 @@ report_disk_utilization_of_the_backup_volume="YES" ## Intenral Varibles # You may wish to change this slightly if you want to check a differnet drive or an OS other than Mac OS X. -# If you are dealing with disk images altering this further may be useful. +# If you are dealing with disk images altering this further may be useful. backupDestVolume=`echo "${backupDest}" | awk -F "/" '{ print $1"/"$2"/"$3}'` backupDestVolume_diskusage_percentage=0 @@ -65,7 +65,7 @@ if ! [ -d "${backupDestVolume}" ] ; then fi -## Functions +## Functions function calculate_disk_usage_for_backup_destination_volume { backupDestVolume_diskusage_percentage=`df -h | grep "${backupDestVolume}" | awk '{print $5}' | awk -F "%" '{print $1}'` if [ $? != 0 ] ; then diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-200-ReportBackupDiskUsagePercentage.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-200-ReportBackupDiskUsagePercentage.bash index 8736acc..9fb6779 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-200-ReportBackupDiskUsagePercentage.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-200-ReportBackupDiskUsagePercentage.bash @@ -22,12 +22,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # This script requires LBackup 0.9.8r5 later. # @@ -40,7 +40,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # warmly welcomed : http://www.lbackup.org # # If you would like to cancel a backup should the percentage be -# to low then you should look at the example script called : +# to low then you should look at the example script called : # BACKUP-200-CheckBackupDiskUsagePercentage.bash # @@ -52,7 +52,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## Intenral Varibles # You may wish to change this slightly if you want to check a differnet drive or an OS other than Mac OS X. -# If you are dealing with disk images altering this further may be useful. +# If you are dealing with disk images altering this further may be useful. backupDestVolume=`echo "${backupDest}" | awk -F "/" '{ print $1"/"$2"/"$3}'` backupDestVolume_diskusage_percentage=-1 @@ -65,7 +65,7 @@ if ! [ -d "${backupDestVolume}" ] ; then fi -## Functions +## Functions function calculate_disk_usage_for_backup_destination_volume { backupDestVolume_diskusage_percentage=`df -h | grep "${backupDestVolume}" | awk '{print $5}' | awk -F "%" '{print $1}'` if [ $? != 0 ] || ! [ $backupDestVolume_diskusage_percentage -ge 0 ] ; then diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-300-EnsureFailedBackupWritable.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-300-EnsureFailedBackupWritable.bash index 692a54c..94b5747 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-300-EnsureFailedBackupWritable.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-300-EnsureFailedBackupWritable.bash @@ -22,12 +22,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## @@ -48,6 +48,6 @@ if [ -d "${failed_backup_section}" ] ; then fi fi -exit ${SCRIPT_SUCCESS} +exit ${SCRIPT_SUCCESS} diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-500-Check-Directory-Exists.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-500-Check-Directory-Exists.bash index 5338f6f..1c232c7 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-500-Check-Directory-Exists.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-500-Check-Directory-Exists.bash @@ -21,12 +21,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-500-Check-File-Is-Not-Present.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-500-Check-File-Is-Not-Present.bash index 985742b..6d9d46a 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-500-Check-File-Is-Not-Present.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-500-Check-File-Is-Not-Present.bash @@ -21,16 +21,16 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # -# This is a simple script which checks for that a file is +# This is a simple script which checks for that a file is # not present. If the file exists then the backup will be stopped. # If the file is not detectd then the backup will continue. # diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-550-EnsureDiskImageNotMounted.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-550-EnsureDiskImageNotMounted.bash index 8e2a343..0a1fb0e 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-550-EnsureDiskImageNotMounted.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-550-EnsureDiskImageNotMounted.bash @@ -22,12 +22,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## @@ -44,7 +44,7 @@ fi # Note : This is implimentiation is dependent upon exception being raised by hdiutil # some mount points may not support features required to raise the exceptions. hdiutil imageinfo "${local_image}" 1> /dev/null 2> /dev/null -if [ $? != 0 ] ; then +if [ $? != 0 ] ; then echo " ERROR! : Disk image is mounted or is not available." | tee -ai $logFile exit ${SCRIPT_HALT} fi @@ -52,13 +52,13 @@ fi # Check to see if the image is mounted (locally) hdiutil_mounted_status=`hdiutil info | grep "image-path" | grep "${local_image}"` -if [ -e "${local_image}" ] && [ "${hdiutil_mounted_status}" == "" ] ; then - exit ${SCRIPT_SUCCESS} +if [ -e "${local_image}" ] && [ "${hdiutil_mounted_status}" == "" ] ; then + exit ${SCRIPT_SUCCESS} else echo " ERROR! : Disk image is mounted or is not available." | tee -ai $logFile exit ${SCRIPT_HALT} fi - + diff --git a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-999-OpenLog.bash b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-999-OpenLog.bash index 75b277d..4850744 100755 --- a/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-999-OpenLog.bash +++ b/etc/lbackup/example_backup_config/resources/exmaple-scripts/pre-actions/BACKUP-999-OpenLog.bash @@ -20,12 +20,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## # # This is a simple script which opens the log file diff --git a/etc/lbackup/example_backup_config/resources/ssh-wrappers/README.txt b/etc/lbackup/example_backup_config/resources/ssh-wrappers/README.txt index 2434b00..58410bb 100644 --- a/etc/lbackup/example_backup_config/resources/ssh-wrappers/README.txt +++ b/etc/lbackup/example_backup_config/resources/ssh-wrappers/README.txt @@ -1,10 +1,10 @@ LBACKUP SSH RSYNC WRAPPER README ================================ - -LBackup official website : + +LBackup official website : http://www.lucidsystems.org/tools/lbackup -Details regarding the usage and installation of the +Details regarding the usage and installation of the RSYNC Wrapper Script is available from the following URL : http://www.lucidsystems.org/tools/lbackup/setup/rsyncwrapper diff --git a/etc/lbackup/example_backup_config/resources/ssh-wrappers/lbackup-wrapper.sh b/etc/lbackup/example_backup_config/resources/ssh-wrappers/lbackup-wrapper.sh index ab7f443..3c1d285 100755 --- a/etc/lbackup/example_backup_config/resources/ssh-wrappers/lbackup-wrapper.sh +++ b/etc/lbackup/example_backup_config/resources/ssh-wrappers/lbackup-wrapper.sh @@ -1,7 +1,7 @@ #!/bin/tcsh -f # /etc/rsync-wrapper -# rsync-wrapper shell script. +# rsync-wrapper shell script. # Licensed Under GNU GPL # # Written by : Mike Bombich @@ -9,30 +9,30 @@ # Note : # This script is not the latest version availible. # Although this version has been extensivly tested with LBackup. -# It is reccomended that you obtain the latest version of this script -# along with detailed instructions regarding the configuration of -# SSH access from the following URL : +# It is reccomended that you obtain the latest version of this script +# along with detailed instructions regarding the configuration of +# SSH access from the following URL : # http://www.bombich.com/mactips/rsync.html # # This script is executed when a user from a remote machine -# successfully authenticates with a public key. +# successfully authenticates with a public key. -# The privileges of that user on this server are limited to the -# functionality of this script. This wrapper script will verify +# The privileges of that user on this server are limited to the +# functionality of this script. This wrapper script will verify # that the client is sending authorized command. If the command # is authorized, then the original, unaltered command is run, -# if not, an error is returned. +# if not, an error is returned. # -# By default this access attempts are logged in /var/logs/ +# By default this access attempts are logged in /var/logs/ # provided the script is run as root. However, if the script # is executed by any other user on the system then the access # logs will be stored in /tmp and therefore will not be -# kept on the system for long. +# kept on the system for long. # If you are using this script on a production system then # a log rotation schedule should be configured and tested. # -# +# # # # v1.1 Updated by : Henri Shustak, Lucid Information Systems @@ -53,7 +53,7 @@ # Added option for /usr/local/bin/rsync_v3 # # v1.6 Updated by : Henri Shustak, Lucid Information Systems -# Option for detecting the --delete option +# Option for detecting the --delete option # # ------------------------------------------------------------------- # @@ -62,10 +62,10 @@ # # -# Please report any security advisories to Luicd Information Systems +# Please report any security advisories to Luicd Information Systems # Contact details availible from : http://www.lucidsystems.org -# Settings +# Settings set allowDelete = "false" set current_user_id = (`id -u`) @@ -80,7 +80,7 @@ if ( "${current_user_id}" == "0" ) then else set user_tmp_dir = ("/tmp/${current_user_id}/") set log_dir = ("/tmp/${current_user_id}/lbackup") - if ! ( -d "${log_dir}" ) then + if ! ( -d "${log_dir}" ) then if ! ( -d "${user_tmp_dir}" ) then mkdir -p "${user_tmp_dir}" chmod 700 "${user_tmp_dir}" @@ -119,7 +119,7 @@ endif # rsync in server mode. if (( "$command[1]" == "/usr/local/bin/rsync" ) || ( "$command[1]" == "/usr/bin/rsync" ) || ( "$command[1]" == "/usr/local/bin/rsync_v3" )) then - + # Check for --server set ok1 = false foreach arg ($command) @@ -128,7 +128,7 @@ if (( "$command[1]" == "/usr/local/bin/rsync" ) || ( "$command[1]" == "/usr/bin/ set ok1 = true endif end - + # Check for --sender set ok2 = false foreach arg ($command) @@ -137,7 +137,7 @@ if (( "$command[1]" == "/usr/local/bin/rsync" ) || ( "$command[1]" == "/usr/bin/ set ok2 = true endif end - + # Check for --delete foreach arg ($command) echo "Arg Check --delete :" "$arg" >> $log @@ -147,8 +147,8 @@ if (( "$command[1]" == "/usr/local/bin/rsync" ) || ( "$command[1]" == "/usr/bin/ endif end - - + + # If we're OK, run the rsync server. if (($ok1 == "true") && ($ok2 == "true")) then echo -n "Backup initiated : command recived : `cat ${log}`" | /usr/bin/logger -p 5 -t "lbackup_ssh_wapper[${current_user_id}]" @@ -168,12 +168,12 @@ endif if ( "$command[1]" == "/usr/sbin/sleepy" ) then echo -n "executing command : `cat ${log}`" | /usr/bin/logger -p 5 -t "lbackup_ssh_wapper[${current_user_id}]" $command -endif +endif if ( "$command[1]" == "$lbackup_ssh_test_command" ) then echo -n "Recived LBackup SSH test connection : command recived : `cat ${log}`" | /usr/bin/logger -p 6 -t "lbackup_ssh_wapper[${current_user_id}]" exit 0 -endif +endif diff --git a/usr/local/libexec/lbackup1001/Version History b/usr/local/libexec/lbackup1001/Version History index 6980be6..c025091 100644 --- a/usr/local/libexec/lbackup1001/Version History +++ b/usr/local/libexec/lbackup1001/Version History @@ -1,6 +1,6 @@ - LBACKUP - VERSION HISTORY + LBACKUP - VERSION HISTORY ©2001-2011 ALL RIGHTS RESERVED - LUCID INFORMATION SYSTEMS www.lucidsystems.org @@ -12,21 +12,21 @@ Version 0.9.8r5 Added an additional example pre action script - which simply reports the disk usage of the - backup destination disk. + which simply reports the disk usage of the + backup destination disk. Added an option to the configuration file which allows disabling of the email reporting system. Added an additional example pre action script which will inspect the log and determine the - start time of the most recent successful + start time of the most recent successful backup. If the start time is less than the time specified within the script then backup will be aborted. If the time is greater than that mentioned in the script then the backup will continue. - + Added an additional example pre action script which provides the ability to perform a check regarding the percentage usage of the @@ -49,11 +49,11 @@ scripts in the future. Additional options added to the example - pre-action script for reporting and + pre-action script for reporting and logging system and backup disk usage. Updated the example pre-action script for - detecting if a disk image is mounted on + detecting if a disk image is mounted on Mac OS X systems. If the disk image has been remotely mounted this should now be detected. @@ -62,7 +62,7 @@ of incomplete backups required time. Added configuration options for reporting of - timing relating to failed backups required + timing relating to failed backups required time. Added configuration options for reporting of @@ -73,66 +73,66 @@ Added an example post action script which which may be used to generate a link from - the backup destination directory to the + the backup destination directory to the backup configuration directory. - Improved backup set reliability with + Improved backup set reliability with additional checks relating to the rotation - of the backup snapshots. + of the backup snapshots. Resolved an issue relating to md5 within some of the mail templates on LINUX systems. - + Various minor bug fixes. - Bugs : + Bugs : All other bugs From 0.9.8r4 remain. Version 0.9.8r4 - + Added functionality (disabled by default) to remove old archived rsync session log files. This must be enabled within the post-action script. - - Provided basic LINUX server support to the example + + Provided basic LINUX server support to the example sparse-bundle synchronization post action script. Basic man page is now included. This man page will requires a great deal more work to make it useful. Minor improvements to post action subsystem. - + Added an option for disabling ACL preservation on darwin with custom rsync v3 installed. - + Various other minor improvements. - Added a basic example post action script which reports + Added a basic example post action script which reports the backup completion time. Moved the configuration directory to /etc/lbackup - + Added options for the rsync --checksum to the LBackup configuration file. - + Added options for the rsync --numeric-ids to the LBackup configuration file. - Added the ability to pass the -s flag to the lcd + Added the ability to pass the -s flag to the lcd command so that it may be used within a script. - + Various minor bug fixes. - Bugs : + Bugs : All other bugs From 0.9.8r3 remain. - Version 0.9.8r3 + Version 0.9.8r3 Includes a post action which makes archiving of the sync session logs easy. If enabled this log may be used as a @@ -143,11 +143,11 @@ Initial implementation of custom per backup configuration mail template system. - Improvements to reliability of backups by adding a + Improvements to reliability of backups by adding a snap shot integrity check prior to commencing backup snapshot rotations. - Added errors if the specified custom version of rsync was + Added errors if the specified custom version of rsync was not able to be located on the system when darwin checks are enabled. @@ -164,7 +164,7 @@ problem was caused by an error in the the backup lock exit trap procedure. - Implemented basic checks before sending mail that the + Implemented basic checks before sending mail that the destination address has actually been modified. Added more pre and post action scripts. @@ -173,23 +173,23 @@ Minor bug fixes. - Bugs : + Bugs : All other bugs From 0.9.8r2 remain. - Version 0.9.8r2 + Version 0.9.8r2 - Added a example post action script which will maintain a + Added a example post action script which will maintain a link to the backup destination directory within the backup configuration directory. - The new version of the example post-action script for + The new version of the example post-action script for generating time based links script now generates relative - links by default. This makes it easier to migrate backup + links by default. This makes it easier to migrate backup sets between storage devices or directories. Resolved issue with Mac OS 10.3.9 installer. - + Mac OS X download .dmg size reduced from >500Kb to <200Kb. Basic checks implemented for backup destination and @@ -198,24 +198,24 @@ Added checks for destination volume permissions when executing on Darwin. - Fixed the sender address of emails. Now the - configuration file is honored. + Fixed the sender address of emails. Now the + configuration file is honored. - Resolved an issue with the x-sender header. It is now + Resolved an issue with the x-sender header. It is now set to the sender address. Improved email in certain error conditions. - Improved lock file removal with regards to certain + Improved lock file removal with regards to certain error conditions. Improved post action scripts reliability - Added option in configuration file to allow post action + Added option in configuration file to allow post action scripts to run even on backup error. Resolved issue relating to post script actions running, - even if the atomic swap failed. This is now correctly + even if the atomic swap failed. This is now correctly implemented and will depend upon your post-action configuration settings. @@ -226,43 +226,43 @@ Various other minor improvements to the install process. - Bugs : + Bugs : All other bugs From 0.9.8r1 Remain. Version 0.9.8r1 - + Added the lcd command. - + Set more appropriate default settings. Basic backup in progress locking system implemented. - - Additional parameters are now provided to the pre + + Additional parameters are now provided to the pre and post hook scripts. - + Added additional logging facilities. - + Bundled post script for maintaining a directory of time based symbolic backup links. - Various minor bug fixes and spelling mistakes fixed + Various minor bug fixes and spelling mistakes fixed (there are still many spelling issues) - - Bugs : + + Bugs : All Bugs From 0.9.8q9 Remain. Version 0.9.8q9 - + Minor changes to the example backup configuration. - - Improved reliability of backups which are not being run + + Improved reliability of backups which are not being run as root. - - Bugs : + + Bugs : All Bugs From 0.9.8q8 Remain. @@ -270,12 +270,12 @@ Version 0.9.8q8 Bug fix for dealing with custom SSH rsync paths. - + Minor changes to the example backup configuration. - + Various fixes for SSH wrapper. - - Bugs : + + Bugs : All Bugs From 0.9.8q7 Remain. @@ -283,14 +283,14 @@ Version 0.9.8q7 Improved example backup action scripts. - - Implemented support for rsync v3 and rsync v3 compiled with + + Implemented support for rsync v3 and rsync v3 compiled with additional Mac OS X meta data support patches. - + Added ability to specify the sender name and return address used for email reporting within the mail configuration file. - - Bugs : + + Bugs : All Bugs From 0.9.8q6 Remain. @@ -298,8 +298,8 @@ Version 0.9.8q6 LINUX Backup to OS X improvements. - - Bugs : + + Bugs : All Bugs From 0.9.8q5 Remain. @@ -308,17 +308,17 @@ New options to allow the use of OS X bundled version of rsync for network backups. - - Automatic compatibility checking enabled for OS X bundled - version of rsync. - + + Automatic compatibility checking enabled for OS X bundled + version of rsync. + Ground work for auto detection of remote OS completed. - + Minor code clean up. - + Minor bug fixes. - - Bugs : + + Bugs : All Bugs From 0.9.8q4 Remain. @@ -326,98 +326,98 @@ Version 0.9.8q4 Major Restrictions added to the Example SSH Wrapper - - Bugs : + + Bugs : All Bugs From 0.9.8q3 Remain. Version 0.9.8q3 - Added support for a new configuration file options. - + Added support for a new configuration file options. + Greater control over the rsync options for backups using SSH as the transport protocol. - + Ability to skip the local system checks. - - Bugs : + + Bugs : All Bugs From 0.9.8q Remain. Version 0.9.8q - + Added support for a new configuration file option, allowing the continuation of failed backups. In order to use this option LBackup version 0.9.8q or later is - required. - - Bugs : + required. + + Bugs : All Bugs From 0.9.8p Remain. Version 0.9.8p - + Improved SSH Test Support (backwards compatible). Improved example LSync SSH Wrapper (not backwards compatibe). - - Bugs : + + Bugs : All Bugs From 0.9.8n Remain. - Using the example LSync SSH wrapper version released + Using the example LSync SSH wrapper version released with this version of LBackup in conjunction with an older - version of LBackup will result in SSH tests failing, + version of LBackup will result in SSH tests failing, even though the server may be fine. Upgrading LBackup will resolve this issue. Version 0.9.8n - + Third GNU GPL Release of LBackup. - Corrected Installation script bug. - - Bugs : + Corrected Installation script bug. + + Bugs : All Bugs From 0.9.8k Remain. - + Version 0.9.8k - + Second GNU GPL Release of LBackup. Updated configuration examples to use the correct licence. - Updated the bundled documentation to include a link to the - online documentation. - - Bugs : + Updated the bundled documentation to include a link to the + online documentation. + + Bugs : All Bugs From 0.9.8i Remain. - + Version 0.9.8i - - Included Mike's great SSH wrapper scripts within the - distribution. For more information about using the wrapper - please refer to the online documentation or to Mikes online - RSync pages. - - Bugs : + + Included Mike's great SSH wrapper scripts within the + distribution. For more information about using the wrapper + please refer to the online documentation or to Mikes online + RSync pages. + + Bugs : All Bugs From 0.9.8e Remain. Version 0.9.8e - + Packed Under the GNU GPL for public consumption Documentation is available via a wiki - - Bugs : + + Bugs : All Bugs From 0.9.8c Remain. Version 0.9.8c - + Fixed minor file path resolution bug Added initial ability to determine version of rsync installed Fixing a potential symbolic link chown failure under OS X - - Bugs : + + Bugs : All Bugs From 0.9.8b Remain. All Bugs From 0.9.7 Remain. All Bugs From 0.9.6 Remain. @@ -425,76 +425,75 @@ Version 0.9.8b - + Added option to disable growl notification Fixed internal variable naming conventions inconsistencies Fixed errors in the maillog_script, mail logs will now be sent - - Bugs : - + + Bugs : + All Bugs From 0.9.7 Remain. All Bugs From 0.9.6 Remain. All Bugs From 0.9.5 Remain. - - + + Version 0.9.7 - + Initial support for pre and post actions - Fixed minor variable name issue : + Fixed minor variable name issue : backupConfigurationFolderFolderPath was changed to backupConfigurationFolderPath - Bugs : - + Bugs : + All Bugs From 0.9.6 Remain. All Bugs From 0.9.5 Remain. Version 0.9.6 - + Minor modifications to configuration file (upgraded to 0004) Fully bacwards compatble. Ground work laid pre and post backup scripts default overide in - coniguration file. + coniguration file. + + Bugs : - Bugs : - Issue with excluding unicode files and folders identified. - + Issue with error reports identified and resolved. - + All Bugs From 0.9.5 Remain. Version 0.9.5 - + Basic backup and error reporting are implemented. Completely useable backup solution. Initial Internal use OSX .pkg package completed. - + Works over the network or over on a local host. - + Install Location : /usr/local/libexec/lbackup - Example Location : /lbackup example_coexample_backup_config + Example Location : /lbackup example_coexample_backup_config - Bugs : - - Possible issue identified with using ../ in the path of - configuration files passed in to the system. This will + Bugs : + + Possible issue identified with using ../ in the path of + configuration files passed in to the system. This will be tested in a future version. Please do not specify the path of a configuration file in terms of ../. instead create an alias, the system will resolve the alias. - + The bug may have been introduced while attempting to add symbolic link de-referencing code. This will probably become an option in the future so you can decide weather you would like symbolic links to be dereferenced. - + There is no documentation. - - \ No newline at end of file + diff --git a/usr/local/libexec/lbackup1001/backup_script.bash b/usr/local/libexec/lbackup1001/backup_script.bash index 29dafae..a5077a8 100755 --- a/usr/local/libexec/lbackup1001/backup_script.bash +++ b/usr/local/libexec/lbackup1001/backup_script.bash @@ -29,14 +29,14 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## -## Running this script will perform a +## Running this script will perform a ## backup as specified in the configuration file -## +## ## It is important that you have a copy of Rsync ## installed which will preserve the meta data ## which you are planning to save ## -## Any patches should be submitted to +## Any patches should be submitted to ## http://wwww.lucidsystems.org ## ## LBackup Official Home Page is @@ -46,7 +46,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ################################## ## Structural Overview ## -################################## +################################## # # You should only need to set # the primary configuration @@ -65,7 +65,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Lucid Backup Components : maillog_script.bash # Dependencies : python, ssh, bash, echo, mv, rm, tee, dirname, bc, rsync or RSyncX # - + ## Calculate amount of changed data ## Atomic Version @@ -74,19 +74,19 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ################################## ## Initial Check ## ################################## -# Backup Using ($1) +# Backup Using ($1) # Make sure a file has been passed in on the command line if [ $# -ne 1 ]; then echo 1>&2 Usage: /usr/local/sbin/lbackup configuration_file.conf echo 1>&2 Further information is availible online http://www.lbackup.org exit -127 fi - - - + + + ######################## ## Internal Functions ## -######################## +######################## # Intenral Function Retrun Vlaues @@ -100,7 +100,7 @@ return_value_from_make_seconds_human_readable="" # Called by the get_absolute_path function function resolve_symlinks { # Check if it is an alias - if [ -L "$quoted_absolute_path" ] ; then + if [ -L "$quoted_absolute_path" ] ; then # # If Alias then find where the alias is pointing quoted_absolute_path=`ls -l "$quoted_absolute_path" | awk 'BEGIN { FS = " -> " } ; { print $2 }'` n_links_followed=$[$n_links_followed+1] @@ -114,22 +114,22 @@ function resolve_symlinks { } -# Before calling this function set the variable quoted_absolute_path +# Before calling this function set the variable quoted_absolute_path # to the best guess of the absolute path. eg: quoted_absolute_path="$0" # Upon error : quoted_absolute_path is set to -30 # You should check for this instance a loop has occurred with the links function get_absolute_path { # Find the configuration files absolute path - + # check for ./ at the start local dot_slash_test=`echo "$quoted_absolute_path" | grep '^./'` if [ "$dot_slash_test" != "" ] ; then quoted_absolute_path=`basename $quoted_absolute_path` fi - + # find absolute path (parent path times ".." will not be striped path items) quoted_absolute_path=$(echo $quoted_absolute_path | grep '^/' || echo `pwd`/$quoted_absolute_path) - + # Reset Link Counter n_links_followed=0 # Check if there are any symlinks @@ -153,7 +153,7 @@ function check_mailconfigpartner { if [ "$dot_slash_test" == "" ] && [ "$slash_test" == "" ] ; then # If the mailconfigpartner has no context then assume it is in # the same directory as the backup_config file - if [ "${mailconfigpartner}" != "" ] ; then + if [ "${mailconfigpartner}" != "" ] ; then local mailconfigpartner_name=`basename $mailconfigpartner` else echo "" | tee -ai $logFile @@ -169,28 +169,28 @@ function check_mailconfigpartner { } -# Send Mail Functions +# Send Mail Functions # Sends an email out function send_mail_log { - + if [ "${disable_mailconfigpartner}" != "YES" ] ; then check_mailconfigpartner fi - + ## Close Log File echo "" >> $logFile echo "" >> $logFile - + if [ "${disable_mailconfigpartner}" != "YES" ] ; then bash $currentdir/$mailScriptName "$mailconfigpartner" fi - + return 0 -} +} # Backup Destination Check -# Check that the backup destination directory is available +# Check that the backup destination directory is available function local_backup_destination_availible { # Actually we only check if there is something (not that is a directory) this allows people to # configure links for the backup. An error will be reported if rsync is not able to copy files @@ -207,7 +207,7 @@ function local_backup_destination_availible { # Backup Source Check -# Check that the backup source is availible +# Check that the backup source is availible function local_backup_source_availible { # Actually we only check if there is something (not that is a directory) this allows people to # configure links for the backup. An error will be reported if rsync is not able to copy files @@ -231,7 +231,7 @@ function confirm_backup_integraty { current_set_section_num=0 largest_section_in_set=`ls "${backupDest}/" | grep -e "Section.[0-9]\+" | awk -F "." '{print $2}' | sort -n | awk '{ print $NF }' | tail -n 1` # If there are no pre-existing sections then skip the checks. - if [ "${largest_section_in_set}" != "" ] ; then + if [ "${largest_section_in_set}" != "" ] ; then confirmed_section_num=-1 set_section_integrity_confirmed="NO" while [ $current_set_section_num -le $largest_section_in_set ] ; do @@ -244,7 +244,7 @@ function confirm_backup_integraty { if [ $confirmed_section_num -eq $current_set_section_num ] ; then set_section_integrity_confirmed="YES" fi - if [ "${set_section_integrity_confirmed}" != "YES" ] ; then + if [ "${set_section_integrity_confirmed}" != "YES" ] ; then echo "ERROR! : Backup set integrity is in question." | tee -ai $logFile echo " Before backup snapshot rotation begins, your backup set" | tee -ai $logFile echo " snapshot sections must be in complete sequence." | tee -ai $logFile @@ -256,7 +256,7 @@ function confirm_backup_integraty { send_mail_log exit -1 fi - + # Check for sections which extend beyond the currently configured rotation management range if [ $largest_section_in_set -ge $numRotations ] ; then # Looks like there are some sections which are not going to be managed @@ -276,15 +276,15 @@ function confirm_backup_integraty { } -# Post Action Functions +# Post Action Functions # Performs the post action scripts function perform_post_action_scripts { - + # Perform Post Action Scripts if [ -s "${backup_post_action}" -a -x "${backup_post_action}" ] ; then - + echo "Checking for Post Action Scripts..." - + # Export Appropriate variables to the scripts export logFile # post scripts have the ability to write data to the log file. export rsync_session_log_file # post scripts may want to reference this file. @@ -294,53 +294,53 @@ function perform_post_action_scripts { export backupDest # provides the directory we are storing the backups (carful may be remote). export rsync_session_log_name # provides the name of the rsync session log (file may or may not exit) export numRotations # number of rotations exported. - - # This is only required for the post action not for the pre action + + # This is only required for the post action not for the pre action export pre_backup_script_status # provides access to the pre status of the pre backup script actions. - + # Export the SSH information from the configruation file (probably not required) export useSSH export sshSource export sshRemoteUser export sshRemoteServer - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - - - + + + # Execute the Post Backup Actions (passing all parameters passed to the script) "${backup_post_action}" $* - + # Store the Exit Value from the Pre Backup Script backup_post_action_exit_value=$? - - - if [ ${backup_post_action_exit_value} != ${SCRIPT_SUCCESS} ] ; then - + + + if [ ${backup_post_action_exit_value} != ${SCRIPT_SUCCESS} ] ; then + # Determin weather script errors should be reported ( this will affect backup success status ) - if [ ${backup_post_action_exit_value} == ${SCRIPT_HALT} ] ; then + if [ ${backup_post_action_exit_value} == ${SCRIPT_HALT} ] ; then echo 1>&2 "" | tee -ai $logFile echo 1>&2 "ERROR! : One or more post backup action scripts exited with halt requests. " | tee -ai $logFile - echo 1>&2 " Backup stopping..." | tee -ai + echo 1>&2 " Backup stopping..." | tee -ai echo 1>&2 "" | tee -ai $logFile backup_status="FIALED" fi - + # Check for Warning exit codes - if [ ${backup_post_action_exit_value} == ${SCRIPT_WARNING} ] ; then + if [ ${backup_post_action_exit_value} == ${SCRIPT_WARNING} ] ; then echo 1>&2 "" | tee -ai $logFile echo 1>&2 "WARNING! : One or more post backup action scripts exited with warnings." | tee -ai $logFile - echo 1>&2 " Backup continuing..." | tee -ai + echo 1>&2 " Backup continuing..." | tee -ai echo 1>&2 "" | tee -ai $logFile else - + # Report Undefined Exit Value echo 1>&2 "" | tee -ai $logFile echo 1>&2 "WARNING! : Undefined post action exit value : ${backup_post_action_exit_value}" | tee -ai $logFile - echo 1>&2 " Backup continuing..." | tee -ai + echo 1>&2 " Backup continuing..." | tee -ai echo 1>&2 "" | tee -ai $logFile fi fi @@ -368,7 +368,7 @@ function make_seconds_human_readable { time_to_delete_seconds=`echo "scale=0 ; $difference_in_seconds % 60" | bc -l` if [ ${time_to_delete_days} == 0 ] && [ ${time_to_delete_hours} == 0 ] && [ $time_to_delete_minutes == 0 ] && [ ${time_to_delete_seconds} == 0 ] ; then less_than_one_second_string=" (less than one second)" - fi + fi return_value_from_make_seconds_human_readable="${time_to_delete_days} days, ${time_to_delete_hours} hours, ${time_to_delete_minutes} minutes, ${time_to_delete_seconds} seconds${less_than_one_second_string}" } @@ -379,7 +379,7 @@ function make_seconds_human_readable { # Configuration may override these default settings -# Is the source for this backup located on a remote machine accessed via SSH (YES/NO) +# Is the source for this backup located on a remote machine accessed via SSH (YES/NO) useSSH="NO" # Backup Pre and Post Action Script Variable Initializers - leave these blank @@ -401,7 +401,7 @@ default_ssh_rsync_path_local_darwin="/usr/bin/rsync" custom_ssh_rsync_path_local_darwin="/usr/local/bin/rsync" ssh_rsync_path_local_overidden_by_configuration="NO" -# Local Rsync Path Settings for local backup +# Local Rsync Path Settings for local backup # (fine provided we are running Mac OS 10.4.x or greater) rsync_path_local="" default_rsync_path_local_darwin="/usr/bin/rsync" @@ -466,11 +466,11 @@ default_disable_acl_preservation="NO" backupConfigurationVersion="" backupConfigurationsVersionSet="NO" -# numberic permissions (--numeric-ids) configuration +# numberic permissions (--numeric-ids) configuration numeric_ids_enabled="" default_numeric_ids_enabled="NO" -# checksum enabled (--checksum) configuration +# checksum enabled (--checksum) configuration checksum_enabled="" default_checksum_enabled="NO" @@ -486,7 +486,7 @@ report_removal_times_human_readable="" default_report_removal_times_human_readable="NO" report_removal_times_seconds="" default_report_removal_times_seconds="NO" -# These options are not part of the config example. +# These options are not part of the config example. # They may be set - but not nessasaryly honered. report_removal_time_for_oldest_snap_shot_human_readable="" default_report_removal_time_for_oldest_snap_shot_human_readable="NO" @@ -513,7 +513,7 @@ export backupConfigurationFilePath="$quoted_absolute_path" export backupConfigurationFolderPath=`dirname "$backupConfigurationFilePath"` # Check file specified exists and is a lbackup command file. -if ! [ -f "$backupConfigurationFilePath" ] ; then +if ! [ -f "$backupConfigurationFilePath" ] ; then echo 1>&2 "ERROR! : Specified configuration file dose not exist" | tee -ai $logFile echo " File Referenced : $backupConfigurationFilePath" | tee -ai $logFile exit -127 @@ -544,7 +544,7 @@ if [ "$ssh_rsync_path_local" == "" ] ; then ssh_rsync_path_local="${default_ssh_rsync_path_local_darwin}" else ssh_rsync_path_local_overidden_by_configuration="YES" - + # If we are using SSH then the local version of rsync will need to be set to the local version of rsync specified in the config file if [ "${useSSH}" == "YES" ] ; then custom_rsync_path_local_darwin="${ssh_rsync_path_local}" @@ -623,23 +623,23 @@ fi # Is the configuarion version set if [ "${backupConfigurationVersion}" != "" ] ; then - # This should be improved to check for intergers and possibly even report errors if the minimum version + # This should be improved to check for intergers and possibly even report errors if the minimum version # has not been meet by the configuation file. backupConfigurationsVersionSet="YES" fi # Check if the acl preservation has been set within the configuration file -if [ "$disable_acl_preservation" == "" ] ; then +if [ "$disable_acl_preservation" == "" ] ; then disable_acl_preservation="$default_disable_acl_preservation" fi # Check if the numeric id preservation has been set within the configuration file -if [ "$numeric_ids_enabled" == "" ] ; then +if [ "$numeric_ids_enabled" == "" ] ; then numeric_ids_enabled="$default_numeric_ids_enabled" fi # Check if the numeric checksum option has been enabled within the configuration file -if [ "$numeric_ids_enabled" == "" ] ; then +if [ "$numeric_ids_enabled" == "" ] ; then checksum_enabled="$default_checksum_enabled" fi @@ -738,7 +738,7 @@ quoted_absolute_path=$0; get_absolute_path currentfilepath="$quoted_absolute_path" currentdir=`dirname "$currentfilepath"` -# Set The Utilities Directory Absolute Path +# Set The Utilities Directory Absolute Path utilitiesdir="$currentdir""/""$utilities_folder_name" # Internal Configuration @@ -849,7 +849,7 @@ echo "" >> $logFile # Check for a backup lock and other lock related tasks if it has not been disabled if [ "$ignore_backup_lock" == "NO" ] ; then - + # Check for the lock file if [ -f "$backup_lock_file_absolute_path" ] ; then # It may be good to have further options such as how long ago was the lock file generated etc (ie should the lock be ignored) @@ -857,26 +857,26 @@ if [ "$ignore_backup_lock" == "NO" ] ; then echo " Backup Cancelled." | tee -ai $logFile exit -1 fi - + # Test the ability to write the lock file and report an error if there was one. touch "$backup_lock_file_absolute_path" 2>/dev/null if [ $? != 0 ] ; then - echo "WARNING! : Unable to generate backup lock file : $backup_lock_file_absolute_path" | tee -ai $logFile + echo "WARNING! : Unable to generate backup lock file : $backup_lock_file_absolute_path" | tee -ai $logFile fi - + # Set a trap so that if the backup is unexpectedly exited the lock file will be removed. # # Note : Since LBackup v 0.9.8r3-alpha3 the exit status is now allowed to be what ever the exit status was set. - # To revert to the original behavior add an "exit 0" command within the trap. This will insure + # To revert to the original behavior add an "exit 0" command within the trap. This will insure # that exit 0 will be returned. This note will be handy if you have such a requirement. # trap "{ sleep 0.5 ;rm -f \"$backup_lock_file_absolute_path\"; }" EXIT - + else # Skip backup lock file check notification not written to the log file on purpose (for this version). - echo "Backup lock file check skipped." + echo "Backup lock file check skipped." fi @@ -885,7 +885,7 @@ fi if [ $(echo "$numRotations" | grep -E "^[0-9]+$") ] ; then # integers could have leading zeros if they do then we need to remove them for use with bash processing echo "$numRotations" | grep -v '^0' > /dev/null - if [ $? != 0 ] ; then + if [ $? != 0 ] ; then # If there are leading zeros and the command below is successful then the leading zeos will be stripped as bash # is not capable of dealing with integers with leading zeros numRotations=`echo "${numRotations} * 1" | bc` @@ -895,7 +895,7 @@ if [ $(echo "$numRotations" | grep -E "^[0-9]+$") ] ; then fi fi else - # not a positive integer (excluding zero) + # not a positive integer (excluding zero) number_of_rotations_is_positive_integer="NO" fi if [ "${number_of_rotations_is_positive_integer}" != "YES" ] ; then @@ -915,13 +915,13 @@ if [ "${number_of_rotations_is_positive_integer}" != "YES" ] ; then fi # If the email subsystem has been disabled via the configuration file then att this information to the log. -if [ "${disable_mailconfigpartner}" == "YES" ] ; then +if [ "${disable_mailconfigpartner}" == "YES" ] ; then echo "Email reporting is disabled." | tee -ai $logFile fi # Wake Client if [ "$WAKE" == "YES" ] ; then - echo "Waking Client : $hardware_address..." | tee -ai $logFile + echo "Waking Client : $hardware_address..." | tee -ai $logFile python $utilitiesdir/wake.py $hardware_address sleep 10 fi @@ -938,7 +938,7 @@ if [ "$PingTest" == "YES" ] ; then ## Close Log File echo "" >> $logFile echo "" >> $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -1 @@ -959,12 +959,12 @@ if ( [ "$SSHTest" == "YES" ] && [ "$useSSH" == "YES" ] ) ; then ## Close Log File echo "" >> $logFile echo "" >> $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -1 fi -fi +fi # Check and report if the post action scripts are set to run even if there is an error. @@ -983,9 +983,9 @@ fi # Perform Pre Action Scripts if [ -s "${backup_pre_action}" -a -x "${backup_pre_action}" ] ; then - + echo "Checking for Pre Action Scripts..." - + # Export Appropriate variables to the scripts export logFile # pre scripts have the ability to write data to the log file export rsync_session_log_file # pre scripts may want to use this log @@ -994,53 +994,53 @@ if [ -s "${backup_pre_action}" -a -x "${backup_pre_action}" ] ; then export backupDest # provides the directory we are storing the backups (carful may be remote) export rsync_session_log_name # provides the name of the rsync session log (file may or may not exit). export numRotations # number of rotations exported. - + # Export the SSH information from the configruation file (probably not required) export useSSH export sshSource export sshRemoteUser export sshRemoteServer - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Execute the Pre Backup Actions (passing all parameters passed to the script) "${backup_pre_action}" $* - + # Store the Exit Value from the Pre Backup Script backup_pre_action_exit_value=$? - + if [ ${backup_pre_action_exit_value} == ${SCRIPT_SUCCESS} ] ; then # Set Pre Backup Script Success Flag pre_backup_script_status="SUCCESS" else # Determin weather to proceed with the backup - if [ ${backup_pre_action_exit_value} == ${SCRIPT_HALT} ] ; then + if [ ${backup_pre_action_exit_value} == ${SCRIPT_HALT} ] ; then echo 1>&2 "ERROR! : Pre Backup Action Script Failed : Backup Aborted" | tee -ai $logFile - + if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi - + send_mail_log - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" - + exit ${SCRIPT_HALT} fi # Check for other exit codes - if [ ${backup_pre_action_exit_value} == ${SCRIPT_WARNING} ] ; then + if [ ${backup_pre_action_exit_value} == ${SCRIPT_WARNING} ] ; then echo 1>&2 "WARNING! : One or more pre backup action scripts resulted in warning : backup continuing..." | tee -ai $logFile else # Report Undefined Exit Value echo 1>&2 "WARNING! : Undefined Pre Action Exit Value : ${backup_pre_action_exit_value}" | tee -ai $logFile - echo 1>&2 " Backup Continuing..." | tee -ai + echo 1>&2 " Backup Continuing..." | tee -ai fi - fi + fi fi @@ -1057,13 +1057,13 @@ if [ "${local_backup_and_source_availibility_checks_enabled}" == "YES" ] ; then # This is not yet implemented or even planned. It is just a possibility. local_backup_destination_availible - # Check if the backup source is available - currently only local. + # Check if the backup source is available - currently only local. # This will probably be extended to network backups in the future. if [ "$useSSH" != "YES" ] ; then # The source is local so check if the local source is available local_backup_source_availible fi - + fi @@ -1077,16 +1077,16 @@ fi if ! [ -f $EXCLUDES ] ; then echo "Exclude-definitions missing" | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 -fi +fi # Check if Hard Links Are Required if [ $numRotations -ge 1 ] ; then - #Check if there are files to link to + #Check if there are files to link to if [ -d "$linkDest" ] ; then #make sure links are created createLinks="YES" @@ -1113,22 +1113,22 @@ if [ -d "$backupDestCRotTemp" ] ; then rm -Rf "$backupDestCRotTemp" if [ $? == 0 ] ; then successfully_removed_failed_backup="YES" - fi + fi fi else successfully_removed_failed_backup="YES" fi - + if [ "${successfully_removed_failed_backup}" != "YES" ] ; then - + backup_status="FIALED" - + echo "ERROR! : Removing Temporary Directory (previous failed backup)" | tee -ai $logFile if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi - + send_mail_log # Remove the backup lock file - probably not required - this will be handled by the trap @@ -1170,42 +1170,42 @@ fi # Set Show Progress showProgress="NO" -# Checks the Remote OS if this backup is via SSH +# Checks the Remote OS if this backup is via SSH # (NOT CURRENTLY IN USE REQUIRES FURTHER TESTING + DO YOU WANT TO HAVE ANOTHER PASSWORD PROMPT OR HOLE IN SSH WRAPPER) if [ "$check_remote_system" == "YES" ] && [ useSSH="YES" ] ; then - + echo "Testing Remote System Type and Version..." | tee -ai $logFile check_remote_system_results=`ssh $sshSource "uname -rs"` remote_system_check_TestResult=${?} - + if [ ${remote_system_check_TestResult} != 0 ] || [ "${check_remote_system_results}" == "" ] ; then echo "ERROR! : Unable to determine remote system type or version." | tee -ai $logFile echo " Check the remote host is reachable and if you are using key based authentication that" | tee -ai $logFile echo " any wrapper scripts allow remote access to calls to the command : \"uname -rs\"" | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 else - + # Calculate the remote system type and version remote_system_type=`echo ${check_remote_system_results} | awk '{ print $1 }'` remote_system_version=`echo ${check_remote_system_results} | awk '{ print $2 }'` - # Log the System Type and Version -- before this can be enabled we need to check the error checking code. + # Log the System Type and Version -- before this can be enabled we need to check the error checking code. #echo " Remote System Name : ${remote_system_type}" | tee -ai $logFile #echo " Remote System Version : ${remote_system_version}" | tee -ai $logFile - + if [ "${remote_system_type}" == "Darwin" ] ; then - + accept_default_rsync_darwin_remote_ssh="NO" - + # Calculate the remote major darwin version remote_system_major_version_darwin=`echo ${remote_system_version} | awk -F "." '{print $1}'` if [ $? != 0 ] ; then remote_darwin_version="ERROR" fi - + # Sets the minimum version of Darwin when using the remote version of the OS bundled version of rysnc ( darwin version 8 is equivilent to tiger ) darwin_standard_rsync_minimum_version_remote=8 @@ -1218,15 +1218,15 @@ if [ "$check_remote_system" == "YES" ] && [ useSSH="YES" ] ; then # that we are running a good version and also not that resource forks, may take up more space. accept_default_rsync_darwin_remote_ssh="YES" fi - else + else echo "ERROR! : Unable to determine major Darwin release version of the remote machine." | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 - fi + fi fi - fi + fi fi @@ -1235,12 +1235,12 @@ fi local_system_name=`uname` if [ "$check_local_system" == "YES" ] ; then - + # This system has been tested on HFS+ formated partitions. It requires testing on other formats. # If LBackup is running on Darwin then lets set the appropriate options for a backup if [ "$local_system_name" == "Darwin" ] ; then - + # So we are running on Darwin, in which case there is probably some meta data which needs to be beacked up. # Check the version of Darwin which is running - ie 10.3.x / 10.4.x / 10.5.x ...etc @@ -1284,22 +1284,22 @@ if [ "$check_local_system" == "YES" ] ; then # Check if there are any custom rsync versions installed locally if [ -f ${custom_rsync_path_local_darwin} ] ; then installed_rsync_version=`${custom_rsync_path_local_darwin} --version | head -n 1` - + # Gathter Some Additional Information Regarding the Current Version of Rsync installed_rsync_version_number=`${custom_rsync_path_local_darwin} --version | head -n 1 | awk '{print $3}'` installed_rsync_version_number_major=`${custom_rsync_path_local_darwin} --version | head -n 1 | awk '{print $3}' | awk -F "." '{print $1}'` installed_rsync_version_support_for_preserve_create_times=`${custom_rsync_path_local_darwin} --help | grep -e "--crtimes" | awk '{print $1}' | grep -e "-N" | cut -c 1-2` installed_rsync_version_support_for_preserve_file_flags=`${custom_rsync_path_local_darwin} --help | grep -e "--fileflags" | awk '{print $1}' | grep -e "--fileflags"` installed_rsync_version_support_for_affect_immutable_files=`${custom_rsync_path_local_darwin} --help | grep -e "--force-change" | awk '{print $1}' | grep -e "--force-change"` - + # Check if the custom local version of rsync supports mac OSX meta data custom_rsync_path_local_supports_mac_osx_metadata="NO" if [ ${installed_rsync_version_number_major} -ge 3 ] && [ "${installed_rsync_version_support_for_preserve_create_times}" == "-N" ] && [ "${installed_rsync_version_support_for_preserve_file_flags}" == "--fileflags" ] && [ "${installed_rsync_version_support_for_affect_immutable_files}" == "--force-change" ] ; then custom_rsync_path_local_supports_mac_osx_metadata="YES" fi - + else - + # Check if there was a custom_rsync_path_local_darwin option set in the configuration if [ "${custom_rsync_path_local_darwin_overidden_by_configuration}" == "YES" ] ; then # Provide feed back that the specified custom_rsync_path_local_darwin option was not able to be found on the system @@ -1317,7 +1317,7 @@ if [ "$check_local_system" == "YES" ] ; then send_mail_log exit -1 fi - + echo "Checking Default Rsync Version..." | tee -ai $logFile installed_rsync_version="STANDARD" @@ -1328,23 +1328,23 @@ if [ "$check_local_system" == "YES" ] ; then installed_rsync_version_support_for_preserve_file_flags=`${default_ssh_rsync_path_local_darwin} --help | grep -e "--fileflags" | awk '{print $1}' | grep -e "--fileflags"` installed_rsync_version_support_for_affect_immutable_files=`${default_ssh_rsync_path_local_darwin} --help | grep -e "--force-change" | awk '{print $1}' | grep -e "--force-change"` - fi - - + fi + + # Parameters for selecting the standard version of rsync. - + # By default do we allow the default version of rsync. #accept_default_rsync_darwin="NO" accept_default_rsync_darwin="YES" - + if [ "$ssh_permit_standard_rsync_version" == "NO" ] && [ "$useSSH" == "YES" ]; then accept_default_rsync_darwin_remote_ssh="NO" accept_default_rsync_darwin="NO" fi - + # Determines that the minimum version of Darwin when using the local version of rysnc ( darwin version 8 is equivilent to tiger ) darwin_standard_rsync_minimum_version_local=8 - + # Determine whether the standard version of rsync is acceptable for local use # This depends upon two factors. The first factor is to do with the version of darwin on the local system. # The second factor involved is wheather this is a network backup (via SSH). @@ -1356,9 +1356,9 @@ if [ "$check_local_system" == "YES" ] ; then # default version of rsync bundeed with Mac OS X to be suffecient. Using the default version # of rsync which is bundeled with the Mac OS X will result in the resource forks sometimes # requring more storage space as they are not always hard linked correctly. - accept_default_rsync_darwin="YES" + accept_default_rsync_darwin="YES" fi - else + else if [ "${custom_rsync_path_local_supports_mac_osx_metadata}" == "YES" ] ; then # The custom version of Rsync supports all the Mac OS X support we require. Lets us it rather than the default Mac OS X version. accept_default_rsync_darwin="NO" @@ -1375,45 +1375,45 @@ if [ "$check_local_system" == "YES" ] ; then # default version of rsync bundled with Mac OS X to be sufficient. Using the default version # of rsync which is bundled with the Mac OS X will result in the resource forks sometimes # requiring more storage space as they are not always hard linked correctly. - accept_default_rsync_darwin="YES" + accept_default_rsync_darwin="YES" else if [ "$useSSH" == "NO" ] ; then - # Running a local backup on Mac OS X 10.3.9 or earlier. Therefore, we are not going to use - # the default Mac OS X bundled version of rsync. + # Running a local backup on Mac OS X 10.3.9 or earlier. Therefore, we are not going to use + # the default Mac OS X bundled version of rsync. accept_default_rsync_darwin="NO" fi fi fi fi - - - # Set hard link options appropriately + + + # Set hard link options appropriately # Code is turning into spaghetti, this needs to be re-factored. # ( code will require tidy up - check for all possibilities on all plat forms ) # needs to be made platform independent - + # # -e, --rsh=COMMAND specify the remote shell # -a, --archive archive mode, equivalent to -rlptgoD # -h, --help show this help screen # -s is unknowen # -f is unknowen - # - + # + # Set Hard Link Options to null hardlink_option="" - + function rsync_version_unkown { echo "ERROR! : Unknown Version of Rsync Installed" | tee -ai $logFile echo " Check available rsync options, before proceeding " | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 } - - + + if [ "$installed_rsync_version" == "STANDARD" ] && [ "$accept_default_rsync_darwin" == "NO" ] ; then echo "ERROR! : Only standard version of rsync installed" | tee -ai $logFile echo " The standard rsync version will not preserve much meta data." | tee -ai $logFile @@ -1421,14 +1421,14 @@ if [ "$check_local_system" == "YES" ] ; then echo " Download patched rsync version from the URL below :" | tee -ai $logFile echo " http://www.lucidsystems.org/lbackup" | tee -ai $logFile echo " Backup canceled." | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 fi - + if [ "$accept_default_rsync_darwin" == "NO" ] ; then - + # set the local rsync path to the default custom version of rsync rsync_path_local="$custom_rsync_path_local_darwin" @@ -1441,17 +1441,17 @@ if [ "$check_local_system" == "YES" ] ; then if [ "${ssh_rsync_path_local_overidden_by_configuration}" == "NO" ] ; then ssh_rsync_path_local="$custom_ssh_rsync_path_local_darwin" fi - - - # check if we are running rsync version 3 or later + + + # check if we are running rsync version 3 or later # This is only checking the local version. This should be updated to work with all versions. if [ ${installed_rsync_version_number_major} -ge 3 ]; then # Set options for rsync version 3 to preserve meta data on mac OS X - + echo "Using custom rsync : v3..." | tee -ai $logFile - + # This small x option will mean that we do not cross file system bounderies...think abou this.... - + if [ "${custom_rsync_path_local_supports_mac_osx_metadata}" == "YES" ] ; then #hardlink_option="-NHAXEx --protect-args --fileflags --force-change" if [ "${disable_acl_preservation}" == "YES" ] ; then @@ -1464,7 +1464,7 @@ if [ "$check_local_system" == "YES" ] ; then else echo "WARNING : This copy of RSYNC may not support certain Mac OS X meta-data." | tee -ai $logFile #hardlink_option="-HAXEx --protect-args --fileflags --force-change" - # This will also disable the "-N, --crtimes" rsync option - maybe a check can be added to see + # This will also disable the "-N, --crtimes" rsync option - maybe a check can be added to see # it is possible to leave the -N option? if [ "${disable_acl_preservation}" == "YES" ] ; then # Remove the A (ACL) flag from the hard linking options @@ -1475,42 +1475,42 @@ if [ "$check_local_system" == "YES" ] ; then fi fi fi - + # If we are only accepting a patched version of rsync and the local rsync path has not been overidden, # then lets set some options for meta data preseivation. if [ "$accept_default_rsync_darwin" == "NO" ] && [ "${rsync_path_local_overidden_by_configuration}" == "NO" ] && [ "${ssh_rsync_path_remote_overidden_by_configuration}" == "NO" ] && [ "${ssh_rsync_path_local_overidden_by_configuration}" == "NO" ] ; then - + # Check for RsyncX or rsync (with fixed chown) if [ "$installed_rsync_version" == "rsync version 2.6.0 protocol version 27" ] ; then - + # Check that the corrisponding os x package is installed rsync_search="RsyncX_v2.1.pkg" osx_package_check=`ls /Library/Receipts | grep -x "$rsync_search"` - + if [ "$osx_package_check" == "$rsync_search" ] ; then echo "Using custom rsync : RsyncX..." | tee -ai $logFile - - # We are deling with an older version of rsync (possibly RsyncX 2.1), this will require additional flags + + # We are deling with an older version of rsync (possibly RsyncX 2.1), this will require additional flags hardlink_option="--eahfs" else # Unrcognised Version of Rsync rsync_version_unkown fi - + fi - + # Check for chown Fixed Version of Rsync if [ "$installed_rsync_version" == "rsync version 2.6.3 protocol version 28" ] ; then - + # Check that the corrisponding os x package is installed rsync_search="rsync.pkg" osx_package_check=`ls /Library/Receipts | grep -x "$rsync_search"` - + if [ "$osx_package_check" == "$rsync_search" ] ; then echo "Using custom rsync : v2..." | tee -ai $logFile - - # We are deling with a patched version of rsync which is set to preserve some meta data + + # We are deling with a patched version of rsync which is set to preserve some meta data #hardlink_option="--hfs-mode=appledouble" hardlink_option="" echo "WARNING : This copy of RSYNC may not support certain Mac OS X meta-data." | tee -ai $logFile @@ -1523,21 +1523,21 @@ if [ "$check_local_system" == "YES" ] ; then else # Check if we are accepting the standard version of rsync - # The standard version of rsync on the local machine is fine and or + # The standard version of rsync on the local machine is fine and or # the standard version on the remote machine is fine for an SSH Backup if [ "$accept_default_rsync_darwin" == "YES" ] && [ ${installed_rsync_version_number_major} -le 2 ] ; then # The standard version of rsync is fine therefore lets set the preserver extended attributs option # for use with the standard version of rsync that shipped with this version of darwin. This can be abbriviated with -E # note that some extended-attributes with this option will take up extra space beacuase the standard version of rsync - # is not able to hard link the resoruce forks for some files. + # is not able to hard link the resoruce forks for some files. #hardlink_option="--extended-attributes" echo "WARNING : This copy of RSYNC may not support certain Mac OS X meta-data." hardlink_option="-E" #hardlink_option="-NHAXEx --protect-args --fileflags --force-change" - fi - + fi + fi - + fi fi @@ -1567,7 +1567,7 @@ if [ "$showProgress" == "YES" ] ; then #options="--protocol=28 --rsync-path=${ssh_rsync_path_remote} --stats -az ${hardlink_option} --showtogo -e ssh --modify-window=20 --delete-excluded --exclude-from=$EXCLUDES" options="--rsync-path=${ssh_rsync_path_remote} ${change_options} ${checksum_options} ${numeric_id_options} --stats -az ${hardlink_option} --showtogo --modify-window=20 --delete-excluded --exclude-from=$EXCLUDES -e ssh" - + else #nonSSH options @@ -1624,13 +1624,13 @@ if [ "$createLinks" == "NO" ] ; then #time /usr/local/bin/rsync $options $sshSource:"$backupSource" "$backupDestCRotTemp" | tee -ai $logFile time ${ssh_rsync_path_local} $options $sshSource:"$backupSource" "$backupDestCRotTemp" 2>&1 | tee -ai $logFile - + else - #Source is locally available + #Source is locally available #time /usr/local/bin/rsync $options "$backupSource" "$backupDestCRotTemp" | tee -ai $logFile time ${rsync_path_local} $options "$backupSource" "$backupDestCRotTemp" 2>&1 | tee -ai $logFile fi - + else # Create Links echo "Creating Links" | tee -ai $logFile @@ -1641,12 +1641,12 @@ else time ${ssh_rsync_path_local} $options --link-dest="$linkDest" $sshSource:"$backupSource" "$backupDestCRotTemp" 2>&1 | tee -ai $logFile else - #Source is locally available + #Source is locally available #time /usr/local/bin/rsync $options --link-dest="$linkDest" "$backupSource" "$backupDestCRotTemp" | tee -ai $logFile time ${rsync_path_local} $options --link-dest="$linkDest" "$backupSource" "$backupDestCRotTemp" 2>&1 | tee -ai $logFile fi - + fi if [ "${report_snapshot_time_human_readable}" == "YES" ] || [ "${report_snapshot_time_seconds}" == "YES" ] ; then @@ -1666,7 +1666,7 @@ backupResult=`cat $logFile | tail -n 1 | grep "speedup" | awk '{ print $5 }'` backupResultRsyncErrorCheck=`cat $logFile | tail -n 15 | grep "rsync error"` # Check the data trasfer was not interupted - During This Sync -if [ "$backupResult" != "speedup" ] ; then +if [ "$backupResult" != "speedup" ] ; then backup_status="FIALED" fi @@ -1682,10 +1682,10 @@ if [ "${report_snapshot_time_human_readable}" == "YES" ] || [ "${report_snapshot # Calculate the human readable format in case it is required later (failed backup senario) make_seconds_human_readable "${total_time_required_for_snapshot_in_seconds}" # provided the backup has not failed report time taken - if [ "$backup_status" != "FIALED" ] && [ "${report_snapshot_time_human_readable}" == "YES" ] ; then + if [ "$backup_status" != "FIALED" ] && [ "${report_snapshot_time_human_readable}" == "YES" ] ; then echo "Time required for snapshot generation : ${return_value_from_make_seconds_human_readable}" | tee -ai $logFile fi - if [ "$backup_status" != "FIALED" ] && [ "${report_snapshot_time_seconds}" == "YES" ] ; then + if [ "$backup_status" != "FIALED" ] && [ "${report_snapshot_time_seconds}" == "YES" ] ; then echo "Seconds required for snapshot generation : ${total_time_required_for_snapshot_in_seconds}" | tee -ai $logFile fi fi @@ -1702,24 +1702,24 @@ fi # Check the data trasfer was not interupted - During This Sync -if [ "$backup_status" == "FIALED" ] ; then - - echo "" | tee -ai $logFile +if [ "$backup_status" == "FIALED" ] ; then + + echo "" | tee -ai $logFile echo "WARNING! : Data Transfer Interrupted" | tee -ai $logFile - + # Check if we are meant to report the time spent on the incomplete transfer if [ "${report_snapshot_time_human_readable}" == "YES" ] ; then echo "Time required for incomplete snapshot generation : ${return_value_from_make_seconds_human_readable}" | tee -ai $logFile fi - if [ "${report_snapshot_time_seconds}" == "YES" ] ; then + if [ "${report_snapshot_time_seconds}" == "YES" ] ; then echo "Seconds required for incomplete snapshot generation : ${total_time_required_for_snapshot_in_seconds}" | tee -ai $logFile fi - + if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi - + send_mail_log # Remove the backup lock file - probably not required - this will be handled by the trap @@ -1730,22 +1730,22 @@ fi # Check that RSYNC did not encouter any errors - Within 15 lines of logfile if [ "$backupResultRsyncErrorCheck" != "" ] ; then - + backup_status="FIALED" - - echo "" | tee -ai $logFile + + echo "" | tee -ai $logFile echo "WARNING! : RSYNC Encountered Errors" | tee -ai $logFile - + if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi - + send_mail_log - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" - exit -1 + exit -1 fi @@ -1757,7 +1757,7 @@ if [ $numRotations -ge 1 ] ; then sync_file_systems confirm_backup_integraty - + # Setup Rotation Parameters locA=$[$numRotations-2] locB=$[$numRotations-1] @@ -1805,7 +1805,7 @@ if [ $numRotations -ge 1 ] ; then if [ -d "$backupDest/Section.$locA" ] ; then # not used for atomic backup - order is reversed createLinks="YES" - + # Check the destination rotation is not going to be overwirtten (should never happen anyway) if ! [ -e "$backupDest/Section.$locB" ] ; then mv -f "$backupDest/Section.$locA" "$backupDest/Section.$locB" @@ -1851,14 +1851,14 @@ mv "$backupDestCRotTemp" "$backupDestCRot" if [ $? != 0 ] ; then echo "ERROR! : Performing Atomic Swap" | tee -ai $logFile backup_status="FIALED" - + if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi send_mail_log - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -1 @@ -1870,7 +1870,7 @@ perform_post_action_scripts # Report if the Backup was Sccessfull. -if [ "${backup_status}" == "SUCCESS" ] ; then +if [ "${backup_status}" == "SUCCESS" ] ; then echo "Backup Completed Successfully" | tee -ai $logFile fi @@ -1896,23 +1896,23 @@ fi if [ "$sendGrowlNotification" == "YES" ] ; then - # Set Growl Out Location + # Set Growl Out Location growl_out_location="/usr/sbin/growlout" echo "Sending Growl Notification..." - + if [ "$useSSH" == "YES" ] ; then ssh $sshSource "$growl_out_location" fi if [ "$useSSH" == "NO" ] ; then - # Check growlout is installed + # Check growlout is installed if [ -f "$growl_out_location" ] ; then "/usr/sbin/growlout" else echo " WARNING! : Growl out was not installed at : $growl_out_location" fi fi - + fi diff --git a/usr/local/libexec/lbackup1001/backup_version/backup_script.bash b/usr/local/libexec/lbackup1001/backup_version/backup_script.bash index 6fed562..7a0bb99 100755 --- a/usr/local/libexec/lbackup1001/backup_version/backup_script.bash +++ b/usr/local/libexec/lbackup1001/backup_version/backup_script.bash @@ -29,15 +29,15 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## -## Running this script will perform a +## Running this script will perform a ## backup as specified in the configuration file ## (C)2005 Lucid Information Systems -## +## ## It is important that you have a copy of Rsync ## installed which will preserve the meta data ## which you are planning to save ## -## Any patches should be submitted to +## Any patches should be submitted to ## http://wwww.lucidsystems.org ## ## LBackup Official Home Page is @@ -47,7 +47,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ################################## ## Structural Overview ## -################################## +################################## # # You should only need to set # the primary configuration @@ -66,7 +66,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Lucid Backup Components : maillog_script.bash # Dependencies : python, ssh, bash, echo, mv, rm, tee, dirname, rsync or RSyncX # - + ## Calculate amount of changed data ## Atomic Version @@ -75,18 +75,18 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ################################## ## Initial Check ## ################################## -# Backup Using ($1) +# Backup Using ($1) # Make sure a file has been passed in on the command line if [ $# -ne 1 ]; then echo 1>&2 Usage: /usr/local/sbin/lbackup configuration_file.conf exit -127 fi - - - + + + ######################## ## Internal Functions ## -######################## +######################## # Function is used by get_absolute_path function @@ -95,7 +95,7 @@ fi # Called by the get_absolute_path funtion function resolve_symlinks { # Check if it is an alias - if [ -L "$quoted_absolute_path" ] ; then + if [ -L "$quoted_absolute_path" ] ; then # # If Alias then find where the alias is pointing quoted_absolute_path=`ls -l "$quoted_absolute_path" | awk 'BEGIN { FS = " -> " } ; { print $2 }'` n_links_followed=$[$n_links_followed+1] @@ -109,22 +109,22 @@ function resolve_symlinks { } -# Before calling this function set the varible quoted_absolute_path +# Before calling this function set the varible quoted_absolute_path # to the best guess of the absolute path. eg: quoted_absolute_path="$0" # Upon error : quoted_absolute_path is set to -30 # You should check for this instance a loop has occoured with the links function get_absolute_path { # Find the configuration files absolute path - + # check for ./ at the start local dot_slash_test=`echo "$quoted_absolute_path" | grep '^./'` if [ "$dot_slash_test" != "" ] ; then quoted_absolute_path=`basename $quoted_absolute_path` fi - + # find absolute path (parent path times ".." will not be striped path items) quoted_absolute_path=$(echo $quoted_absolute_path | grep '^/' || echo `pwd`/$quoted_absolute_path) - + # Reset Link Counter n_links_followed=0 # Check if there are any symlinks @@ -153,22 +153,22 @@ function check_mailconfigpartner { } -# Send Mail Functions +# Send Mail Functions # Sends an email out function send_mail_log { check_mailconfigpartner - + ## Close Log File echo "" >> $logFile echo "" >> $logFile - + bash $currentdir/$mailScriptName "$mailconfigpartner" return 0 -} +} # Backup Destionion Check -# Check that the backup destination directory is availible +# Check that the backup destination directory is availible function local_backup_destination_availible { # Actually we only check if there is something (not that is a directory) this allows people to # configure links for the backup. An error will be reported if rsync is not able to copy files @@ -185,7 +185,7 @@ function local_backup_destination_availible { # Backup Source Check -# Check that the backup source is availible +# Check that the backup source is availible function local_backup_source_availible { # Actually we only check if there is something (not that is a directory) this allows people to # configure links for the backup. An error will be reported if rsync is not able to copy files @@ -201,10 +201,10 @@ function local_backup_source_availible { } -# Post Action Functions +# Post Action Functions # Performs the post action scripts function perform_post_action_scripts { - + # Perform Post Action Scripts if [ -s "${backup_post_action}" -a -x "${backup_post_action}" ] ; then @@ -217,8 +217,8 @@ function perform_post_action_scripts { export backup_status # provides feed back regarding the status of the backup. export backupSource # provides the directory we are backing up (carful may be remote). export backupDest # provides the directory we are storing the backups (carful may be remote). - - # This is only required for the post action not for the pre action + + # This is only required for the post action not for the pre action export pre_backup_script_status # provides access to the pre status of the pre backup script actions. # Export the Script Return Codes @@ -233,26 +233,26 @@ function perform_post_action_scripts { backup_post_action_exit_value=$? - if [ ${backup_post_action_exit_value} != ${SCRIPT_SUCCESS} ] ; then + if [ ${backup_post_action_exit_value} != ${SCRIPT_SUCCESS} ] ; then # Determin weather script errors should be reported ( this will affect backup success status ) - if [ ${backup_post_action_exit_value} == ${SCRIPT_HALT} ] ; then + if [ ${backup_post_action_exit_value} == ${SCRIPT_HALT} ] ; then echo 1>&2 "ERROR! : Post Backup Action Script Failed : Backup Aborted Requested" | tee -ai $logFile backup_status="FIALED" fi # Check for Warning exit codes - if [ ${backup_post_action_exit_value} == ${SCRIPT_WARNING} ] ; then + if [ ${backup_post_action_exit_value} == ${SCRIPT_WARNING} ] ; then echo 1>&2 "WARNING! : Post Backup Action Resulted in Warning : Backup Continuing..." | tee -ai $logFile else # Report Undefined Exit Value echo 1>&2 "WARNING! : Undefined Post Action Exit Value : ${backup_post_action_exit_value}" | tee -ai $logFile - echo 1>&2 " Backup Continuing..." | tee -ai + echo 1>&2 " Backup Continuing..." | tee -ai fi fi fi - + } @@ -263,7 +263,7 @@ function perform_post_action_scripts { # Configuration mayoveride these default settings -# Is the source for this backup located on a remote machine acessed via SSH (YES/NO) +# Is the source for this backup located on a remote machine acessed via SSH (YES/NO) useSSH="NO" # Backup Pre and Post Action Script Varible Initilisers - leave these blank @@ -285,7 +285,7 @@ default_ssh_rsync_path_local_darwin="/usr/bin/rsync" custom_ssh_rsync_path_local_darwin="/usr/local/bin/rsync" ssh_rsync_path_local_overidden_by_configuration="NO" -# Local Rsync Path Settings for local backup +# Local Rsync Path Settings for local backup # (fine provided we are running Mac OS 10.4.x or greater) rsync_path_local="" default_rsync_path_local_darwin="/usr/bin/rsync" @@ -347,7 +347,7 @@ export backupConfigurationFilePath="$quoted_absolute_path" export backupConfigurationFolderPath=`dirname "$backupConfigurationFilePath"` # Check file specified exists and is a lbackup command file. -if ! [ -f "$backupConfigurationFilePath" ] ; then +if ! [ -f "$backupConfigurationFilePath" ] ; then echo 1>&2 "ERROR! : Specified configuration file dose not exist" | tee -ai $logFile echo " File Referenced : $backupConfigurationFilePath" | tee -ai $logFile exit -127 @@ -378,7 +378,7 @@ if [ "$ssh_rsync_path_local" == "" ] ; then ssh_rsync_path_local="${default_ssh_rsync_path_local_darwin}" else ssh_rsync_path_local_overidden_by_configuration="YES" - + # If we are using SSH then the local version of rsync will need to be set to the local version of rsync specified in the config file if [ "${useSSH}" == "YES" ] ; then custom_rsync_path_local_darwin="${ssh_rsync_path_local}" @@ -474,7 +474,7 @@ quoted_absolute_path=$0; get_absolute_path currentfilepath="$quoted_absolute_path" currentdir=`dirname "$currentfilepath"` -# Set The Utilities Directory Absolute Path +# Set The Utilities Directory Absolute Path utilitiesdir="$currentdir""/""$utilities_folder_name" # Internal Configuration @@ -572,7 +572,7 @@ echo "" >> $logFile # Check for a backup lock and other lock related tasks if it has not been disabled if [ "$ignore_backup_lock" == "NO" ] ; then - + # Check for the lock file if [ -f "$backup_lock_file_absolute_path" ] ; then # It may be good to have further options such as how long ago was the lock file generated etc (ie should the lock be ignored) @@ -580,25 +580,25 @@ if [ "$ignore_backup_lock" == "NO" ] ; then echo " Backup Cancelled." | tee -ai $logFile exit -1 fi - + # Test the ability to write the lock file and report an error if there was one. touch "$backup_lock_file_absolute_path" 2>/dev/null if [ $? != 0 ] ; then - echo "WARNING! : Unable to generate backup lock file : $backup_lock_file_absolute_path" | tee -ai $logFile + echo "WARNING! : Unable to generate backup lock file : $backup_lock_file_absolute_path" | tee -ai $logFile fi - + # Set a trap so that if the backup is unexpectedly exited the lock file will be removed. trap "{ sleep 0.5 ; rm -f \"$backup_lock_file_absolute_path\"; exit 0 ; }" EXIT else # Skip backup lock file check notification not written to the log file on purpose (for this version). - echo "Backup lock file check skipped." + echo "Backup lock file check skipped." fi # Wake Clinet if [ "$WAKE" == "YES" ] ; then - echo "Waking Client : $hardware_address..." | tee -ai $logFile + echo "Waking Client : $hardware_address..." | tee -ai $logFile python $utilitiesdir/wake.py $hardware_address sleep 10 fi @@ -615,7 +615,7 @@ if [ "$PingTest" == "YES" ] ; then ## Close Log File echo "" >> $logFile echo "" >> $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -1 @@ -636,12 +636,12 @@ if ( [ "$SSHTest" == "YES" ] && [ "$useSSH" == "YES" ] ) ; then ## Close Log File echo "" >> $logFile echo "" >> $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -1 fi -fi +fi # Check and report if the post action scripts are set to run even if there is an error. @@ -660,56 +660,56 @@ fi # Perform Pre Action Scripts if [ -s "${backup_pre_action}" -a -x "${backup_pre_action}" ] ; then - + echo "Checking for Pre Action Scripts..." - + # Export Appropriate varibles to the scripts export logFile # pre scripts have the ability to write data to the log file export rsync_session_log_file # pre scripts may want to use this log export backupConfigurationFolderPath # should have been done previously anyway export backupSource # provides the directory we are backing up (carful may be remote) export backupDest # provides the directory we are storing the backups (carful may be remote) - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Execute the Pre Backup Actions (passing all pararmeters passed to the script) "${backup_pre_action}" $* - + # Store the Exit Value from the Pre Backup Script backup_pre_action_exit_value=$? - + if [ ${backup_pre_action_exit_value} == ${SCRIPT_SUCCESS} ] ; then # Set Pre Backup Script Success Flag pre_backup_script_status="SUCCESS" else # Determin weather to proceed with the backup - if [ ${backup_pre_action_exit_value} == ${SCRIPT_HALT} ] ; then + if [ ${backup_pre_action_exit_value} == ${SCRIPT_HALT} ] ; then echo 1>&2 "ERROR! : Pre Backup Action Script Failed : Backup Aborted" | tee -ai $logFile - + if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi - + send_mail_log - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" - + exit ${SCRIPT_HALT} fi # Check for other exit codes - if [ ${backup_pre_action_exit_value} == ${SCRIPT_WARNING} ] ; then + if [ ${backup_pre_action_exit_value} == ${SCRIPT_WARNING} ] ; then echo 1>&2 "WARNING! : Pre Backup Action Resulted in Warning : Backup Continuing..." | tee -ai $logFile else # Report Undefined Exit Value echo 1>&2 "WARNING! : Undefined Pre Action Exit Value : ${backup_pre_action_exit_value}" | tee -ai $logFile - echo 1>&2 " Backup Continuing..." | tee -ai + echo 1>&2 " Backup Continuing..." | tee -ai fi - fi + fi fi @@ -726,13 +726,13 @@ if [ "${local_backup_and_source_availibility_checks_enabled}" == "YES" ] ; then # This is not yet implimeted or even planned. It is just a possibility. local_backup_destination_availible - # Check if the backup soruce is availible - currenlty only local. + # Check if the backup soruce is availible - currenlty only local. # This will probably be exteded to network backups in the future. if [ "$useSSH" != "YES" ] ; then # The source is local so check if the local source is availible local_backup_source_availible fi - + fi @@ -746,16 +746,16 @@ fi if ! [ -f $EXCLUDES ] ; then echo "Exclude-definitions missing" | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 -fi +fi # Check if Hard Links Are Required if [ $numRotations -ge 2 ] ; then - #Check if there are files to link to + #Check if there are files to link to if [ -d "$linkDest" ] ; then #make sure links are created createLinks="YES" @@ -779,22 +779,22 @@ if [ -d "$backupDestCRotTemp" ] ; then rm -Rf "$backupDestCRotTemp" if [ $? == 0 ] ; then successfully_removed_failed_backup="YES" - fi + fi fi else successfully_removed_failed_backup="YES" fi - + if [ "${successfully_removed_failed_backup}" != "YES" ] ; then - + backup_status="FIALED" - + echo "ERROR! : Removing Temporary Directory" | tee -ai $logFile if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi - + send_mail_log # Remove the backup lock file - probably not required - this will be handled by the trap @@ -818,42 +818,42 @@ fi # Set Show Progress showProgress="NO" -# Checks the Remote OS if this backup is via SSH +# Checks the Remote OS if this backup is via SSH # (NOT CURRNTLY IN USE REQUIRES FURTHER TESTING + DO YOU WANT TO HAVE ANOTHER PASSWORD PROMPT OR HOLE IN SSH WRAPPER) if [ "$check_remote_system" == "YES" ] && [ useSSH="YES" ] ; then - + echo "Testing Remote System Type and Version..." | tee -ai $logFile check_remote_system_results=`ssh $sshSource "uname -rs"` remote_system_check_TestResult=${?} - + if [ ${remote_system_check_TestResult} != 0 ] || [ "${check_remote_system_results}" == "" ] ; then echo "ERROR! : Unable to determine remote system type or version." | tee -ai $logFile echo " Check the remote host is reachable and if you are using key based authentication that" | tee -ai $logFile echo " any wrapper scripts allow remote access to calls to the command : \"uname -rs\"" | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 else - + # Calculate the remote system type and version remote_system_type=`echo ${check_remote_system_results} | awk '{ print $1 }'` remote_system_version=`echo ${check_remote_system_results} | awk '{ print $2 }'` - # Log the System Type and Version -- before this can be enabled we need to check the error checking code. + # Log the System Type and Version -- before this can be enabled we need to check the error checking code. #echo " Remote System Name : ${remote_system_type}" | tee -ai $logFile #echo " Remote System Version : ${remote_system_version}" | tee -ai $logFile - + if [ "${remote_system_type}" == "Darwin" ] ; then - + accept_default_rsync_darwin_remote_ssh="NO" - + # Calculate the remote major dawinn version remote_system_major_version_darwin=`echo ${remote_system_version} | awk -F "." '{print $1}'` if [ $? != 0 ] ; then remote_darwin_version="ERROR" fi - + # Sets the minimum version of Darwin when using the remote version of the OS bundled version of rysnc ( darwin version 8 is equivilent to tiger ) darwin_standard_rsync_minimum_version_remote=8 @@ -866,15 +866,15 @@ if [ "$check_remote_system" == "YES" ] && [ useSSH="YES" ] ; then # that we are running a good version and also not that resource forks, may take up more space. accept_default_rsync_darwin_remote_ssh="YES" fi - else + else echo "ERROR! : Unable to determine major Darwin release version of the remote machine." | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 - fi + fi fi - fi + fi fi @@ -883,12 +883,12 @@ fi local_system_name=`uname` if [ "$check_local_system" == "YES" ] ; then - + # This system has been tested on HFS+ formated partitions. It requires testing on other formats. # If LBackup is running on Darwin then lets set the appropriate options for a backup if [ "$local_system_name" == "Darwin" ] ; then - + # So we are running on Darwin, in which case there is probably some meta data which needs to be beacked up. # Check the version of Darwin which is running - ie 10.3.x / 10.4.x / 10.5.x ...etc @@ -900,22 +900,22 @@ if [ "$check_local_system" == "YES" ] ; then # Check if there are any custom rsync versions insalled locally if [ -f ${custom_rsync_path_local_darwin} ] ; then installed_rsync_version=`${custom_rsync_path_local_darwin} --version | head -n 1` - + # Gathter Some Additional Information Regarding the Current Version of Rsync installed_rsync_version_number=`${custom_rsync_path_local_darwin} --version | head -n 1 | awk '{print $3}'` installed_rsync_version_number_major=`${custom_rsync_path_local_darwin} --version | head -n 1 | awk '{print $3}' | awk -F "." '{print $1}'` installed_rsync_version_support_for_preserve_create_times=`${custom_rsync_path_local_darwin} --help | grep -e "--crtimes" | awk '{print $1}' | grep -e "-N" | cut -c 1-2` installed_rsync_version_support_for_preserve_file_flags=`${custom_rsync_path_local_darwin} --help | grep -e "--fileflags" | awk '{print $1}' | grep -e "--fileflags"` installed_rsync_version_support_for_affect_immutable_files=`${custom_rsync_path_local_darwin} --help | grep -e "--force-change" | awk '{print $1}' | grep -e "--force-change"` - + # Check if the custom local version of rsync supports mac OSX meta data custom_rsync_path_local_supports_mac_osx_metadata="NO" if [ ${installed_rsync_version_number_major} -ge 3 ] && [ "${installed_rsync_version_support_for_preserve_create_times}" == "-N" ] && [ "${installed_rsync_version_support_for_preserve_file_flags}" == "--fileflags" ] && [ "${installed_rsync_version_support_for_affect_immutable_files}" == "--force-change" ] ; then custom_rsync_path_local_supports_mac_osx_metadata="YES" fi - + else - + echo "Checking Default Rsync Version..." | tee -ai $logFile installed_rsync_version="STANDARD" @@ -926,23 +926,23 @@ if [ "$check_local_system" == "YES" ] ; then installed_rsync_version_support_for_preserve_file_flags=`${default_ssh_rsync_path_local_darwin} --help | grep -e "--fileflags" | awk '{print $1}' | grep -e "--fileflags"` installed_rsync_version_support_for_affect_immutable_files=`${default_ssh_rsync_path_local_darwin} --help | grep -e "--force-change" | awk '{print $1}' | grep -e "--force-change"` - fi - - + fi + + # Paramerters for selecting the standard version of rsync. - + # By default do we allow the default version of rsync. #accept_default_rsync_darwin="NO" accept_default_rsync_darwin="YES" - + if [ "$ssh_permit_standard_rsync_version" == "NO" ] && [ "$useSSH" == "YES" ]; then accept_default_rsync_darwin_remote_ssh="NO" accept_default_rsync_darwin="NO" fi - + # Determins that the minimum version of Darwin when using the local version of rysnc ( darwin version 8 is equivilent to tiger ) darwin_standard_rsync_minimum_version_local=8 - + # Determin wheather the standard version of rsync is acceptible for local use # This depends upon two factors. The first factor is to do with the version of darwin on the local system. # The second factor involved is wheather this is a network backup (via SSH). @@ -954,9 +954,9 @@ if [ "$check_local_system" == "YES" ] ; then # default version of rsync bundeed with Mac OS X to be suffecient. Using the default version # of rsync which is bundeled with the Mac OS X will result in the resource forks sometimes # requring more storage space as they are not always hard linked correctly. - accept_default_rsync_darwin="YES" + accept_default_rsync_darwin="YES" fi - else + else if [ "${custom_rsync_path_local_supports_mac_osx_metadata}" == "YES" ] ; then # The custom version of Rsync supports all the Mac OS X support we require. Lets us it rather than the default Mac OS X version. accept_default_rsync_darwin="NO" @@ -973,45 +973,45 @@ if [ "$check_local_system" == "YES" ] ; then # default version of rsync bundeed with Mac OS X to be suffecient. Using the default version # of rsync which is bundeled with the Mac OS X will result in the resource forks sometimes # requring more storage space as they are not always hard linked correctly. - accept_default_rsync_darwin="YES" + accept_default_rsync_darwin="YES" else if [ "$useSSH" == "NO" ] ; then - # Running a local backup on Mac OS X 10.3.9 or earlier. Therefore, we are not going to use - # the default Mac OS X bundled version of rsync. + # Running a local backup on Mac OS X 10.3.9 or earlier. Therefore, we are not going to use + # the default Mac OS X bundled version of rsync. accept_default_rsync_darwin="NO" fi fi fi fi - - - # Set hard link options appropriatly + + + # Set hard link options appropriatly # Code is turning into spaghetti, this needs to be re-factored. # ( code will requrie tidy up - check for all possibilities on all plat forms ) # needs to be made platform independent - + # # -e, --rsh=COMMAND specify the remote shell # -a, --archive archive mode, equivalent to -rlptgoD # -h, --help show this help screen # -s is unknowen # -f is unknowen - # - + # + # Set Hard Link Options to null hardlink_option="" - + function rsync_version_unkown { echo "ERROR! : Unknown Version of Rsync Installed" | tee -ai $logFile echo " Check available rsync options, before proceeding " | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 } - - + + if [ "$installed_rsync_version" == "STANDARD" ] && [ "$accept_default_rsync_darwin" == "NO" ] ; then echo "ERROR! : Only standard version of rsync installed" | tee -ai $logFile echo " The standard rsync version will not preserve much meta data." | tee -ai $logFile @@ -1019,14 +1019,14 @@ if [ "$check_local_system" == "YES" ] ; then echo " Download patched rsync version from the URL below :" | tee -ai $logFile echo " http://www.lucidsystems.org/lbackup" | tee -ai $logFile echo " Backup canceled." | tee -ai $logFile - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -127 fi - + if [ "$accept_default_rsync_darwin" == "NO" ] ; then - + # set the local rsync path to the default custom version of rsync rsync_path_local="$custom_rsync_path_local_darwin" @@ -1039,17 +1039,17 @@ if [ "$check_local_system" == "YES" ] ; then if [ "${ssh_rsync_path_local_overidden_by_configuration}" == "NO" ] ; then ssh_rsync_path_local="$custom_ssh_rsync_path_local_darwin" fi - - - # check if we are running rsync version 3 or later + + + # check if we are running rsync version 3 or later # This is only checking the local version. This should be updated to work with all versions. if [ ${installed_rsync_version_number_major} -ge 3 ]; then # Set options for rsync version 3 to preserve meta data on mac OS X - + echo "Using custom rsync : v3..." | tee -ai $logFile - + # This small x option will mean that we do not cross file system bounderies...think abou this.... - + if [ "${custom_rsync_path_local_supports_mac_osx_metadata}" == "YES" ] ; then #hardlink_option="-NHAXEx --protect-args --fileflags --force-change" hardlink_option="-NHAXE --protect-args --fileflags --force-change" @@ -1059,42 +1059,42 @@ if [ "$check_local_system" == "YES" ] ; then hardlink_option="-HAXE --protect-args --fileflags --force-change" fi fi - + # If we are only accepting a patched version of rsync and the local rsync path has not been overidden, # then lets set some options for meta data preseivation. if [ "$accept_default_rsync_darwin" == "NO" ] && [ "${rsync_path_local_overidden_by_configuration}" == "NO" ] && [ "${ssh_rsync_path_remote_overidden_by_configuration}" == "NO" ] && [ "${ssh_rsync_path_local_overidden_by_configuration}" == "NO" ] ; then - + # Check for RsyncX or rsync (with fixed chown) if [ "$installed_rsync_version" == "rsync version 2.6.0 protocol version 27" ] ; then - + # Check that the corrisponding os x package is installed rsync_search="RsyncX_v2.1.pkg" osx_package_check=`ls /Library/Receipts | grep -x "$rsync_search"` - + if [ "$osx_package_check" == "$rsync_search" ] ; then echo "Using custom rsync : RsyncX..." | tee -ai $logFile - - # We are deling with an older version of rsync (possibly RsyncX 2.1), this will require additional flags + + # We are deling with an older version of rsync (possibly RsyncX 2.1), this will require additional flags hardlink_option="--eahfs" else # Unrcognised Version of Rsync rsync_version_unkown fi - + fi - + # Check for chown Fixed Version of Rsync if [ "$installed_rsync_version" == "rsync version 2.6.3 protocol version 28" ] ; then - + # Check that the corrisponding os x package is installed rsync_search="rsync.pkg" osx_package_check=`ls /Library/Receipts | grep -x "$rsync_search"` - + if [ "$osx_package_check" == "$rsync_search" ] ; then echo "Using custom rsync : v2..." | tee -ai $logFile - - # We are deling with a patched version of rsync which is set to preserve some meta data + + # We are deling with a patched version of rsync which is set to preserve some meta data #hardlink_option="--hfs-mode=appledouble" hardlink_option="" echo "WARNING : This copy of RSYNC may not support certain Mac OS X meta-data." | tee -ai $logFile @@ -1107,21 +1107,21 @@ if [ "$check_local_system" == "YES" ] ; then else # Check if we are accepting the standard version of rsync - # The standard version of rsync on the local machine is fine and or + # The standard version of rsync on the local machine is fine and or # the standard version on the remote machine is fine for an SSH Backup if [ "$accept_default_rsync_darwin" == "YES" ] && [ ${installed_rsync_version_number_major} -le 2 ] ; then # The standard version of rsync is fine therefore lets set the preserver extended attributs option # for use with the standard version of rsync that shipped with this version of darwin. This can be abbriviated with -E # note that some extended-attributes with this option will take up extra space beacuase the standard version of rsync - # is not able to hard link the resoruce forks for some files. + # is not able to hard link the resoruce forks for some files. #hardlink_option="--extended-attributes" echo "WARNING : This copy of RSYNC may not support certain Mac OS X meta-data." hardlink_option="-E" #hardlink_option="-NHAXEx --protect-args --fileflags --force-change" - fi - + fi + fi - + fi fi @@ -1151,7 +1151,7 @@ if [ "$showProgress" == "YES" ] ; then #options="--protocol=28 --rsync-path=${ssh_rsync_path_remote} --stats -az ${hardlink_option} --showtogo -e ssh --modify-window=20 --delete-excluded --exclude-from=$EXCLUDES" options="--rsync-path=${ssh_rsync_path_remote} ${change_options} --stats -az ${hardlink_option} --showtogo --modify-window=20 --delete-excluded --exclude-from=$EXCLUDES -e ssh" - + else #nonSSH options @@ -1204,13 +1204,13 @@ if [ "$createLinks" == "NO" ] ; then #time /usr/local/bin/rsync $options $sshSource:"$backupSource" "$backupDestCRotTemp" | tee -ai $logFile time ${ssh_rsync_path_local} $options $sshSource:"$backupSource" "$backupDestCRotTemp" 2>&1 | tee -ai $logFile - + else - #Source is locally available + #Source is locally available #time /usr/local/bin/rsync $options "$backupSource" "$backupDestCRotTemp" | tee -ai $logFile time ${rsync_path_local} $options "$backupSource" "$backupDestCRotTemp" 2>&1 | tee -ai $logFile fi - + else # Create Links echo "Creating Links" | tee -ai $logFile @@ -1221,12 +1221,12 @@ else time ${ssh_rsync_path_local} $options --link-dest="$linkDest" $sshSource:"$backupSource" "$backupDestCRotTemp" 2>&1 | tee -ai $logFile else - #Source is locally available + #Source is locally available #time /usr/local/bin/rsync $options --link-dest="$linkDest" "$backupSource" "$backupDestCRotTemp" | tee -ai $logFile time ${rsync_path_local} $options --link-dest="$linkDest" "$backupSource" "$backupDestCRotTemp" 2>&1 | tee -ai $logFile fi - + fi @@ -1244,18 +1244,18 @@ backupResult=`cat $logFile | tail -n 1 | grep "speedup" | awk '{ print $5 }'` backupResultRsyncErrorCheck=`cat $logFile | tail -n 15 | grep "rsync error"` # Check the data trasfer was not interupted - During This Sync -if [ "$backupResult" != "speedup" ] ; then - +if [ "$backupResult" != "speedup" ] ; then + backup_status="FIALED" - - echo "" | tee -ai $logFile + + echo "" | tee -ai $logFile echo "WARNING! : Data Transfer Interrupted" | tee -ai $logFile - + if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi - + send_mail_log # Remove the backup lock file - probably not required - this will be handled by the trap @@ -1266,22 +1266,22 @@ fi # Check that RSYNC did not encouter any errors - Within 15 lines of logfile if [ "$backupResultRsyncErrorCheck" != "" ] ; then - + backup_status="FIALED" - - echo "" | tee -ai $logFile + + echo "" | tee -ai $logFile echo "WARNING! : RSYNC Encountered Errors" | tee -ai $logFile - + if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi - + send_mail_log - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" - exit -1 + exit -1 fi @@ -1291,7 +1291,7 @@ if [ $numRotations -ge 2 ] ; then echo "" | tee -ai $logFile echo "Rotating Backups..." | tee -ai $logFile sleep 7 - + # Setup Rotation Parameters locA=$[$numRotations-2] locB=$[$numRotations-1] @@ -1333,14 +1333,14 @@ mv "$backupDestCRotTemp" "$backupDestCRot" if [ $? != 0 ] ; then echo "ERROR! : Performing Atomic Swap" | tee -ai $logFile backup_status="FIALED" - + if [ "$post_actions_on_backup_error" == "YES" ] ; then # We are going to run post actions even though the backup has failed perform_post_action_scripts fi send_mail_log - + # Remove the backup lock file - probably not required - this will be handled by the trap rm -f "$backup_lock_file_absolute_path" exit -1 @@ -1352,7 +1352,7 @@ perform_post_action_scripts # Report if the Backup was Sccessfull. -if [ "${backup_status}" == "SUCCESS" ] ; then +if [ "${backup_status}" == "SUCCESS" ] ; then echo "Backup Completed Successfully" | tee -ai $logFile fi @@ -1378,23 +1378,23 @@ fi if [ "$sendGrowlNotification" == "YES" ] ; then - # Set Growl Out Location + # Set Growl Out Location growl_out_location="/usr/sbin/growlout" echo "Sending Growl Notification..." - + if [ "$useSSH" == "YES" ] ; then ssh $sshSource "$growl_out_location" fi if [ "$useSSH" == "NO" ] ; then - # Check growlout is installed + # Check growlout is installed if [ -f "$growl_out_location" ] ; then "/usr/sbin/growlout" else echo " WARNING! : Growl out was not installed at : $growl_out_location" fi fi - + fi diff --git a/usr/local/libexec/lbackup1001/backup_version/maillog_script.bash b/usr/local/libexec/lbackup1001/backup_version/maillog_script.bash index 4aa2af2..edeea9f 100755 --- a/usr/local/libexec/lbackup1001/backup_version/maillog_script.bash +++ b/usr/local/libexec/lbackup1001/backup_version/maillog_script.bash @@ -9,7 +9,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## (C)2005 ## ## ## ## Version 0.9.8c ## -## ## +## ## ## Developed by Henri Shustak ## ## ## ## Version 0.9.8e ## @@ -24,12 +24,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## ## @@ -68,7 +68,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ######################## ## Internal Functions ## -######################## +######################## # Function is used by get_absolute_path function @@ -77,7 +77,7 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # Called by the get_absolute_path funtion function resolve_symlinks { # Check if it is an alias - if [ -L "$quoted_absolute_path" ] ; then + if [ -L "$quoted_absolute_path" ] ; then # # If Alias then find where the alias is pointing quoted_absolute_path=`ls -l "$quoted_absolute_path" | awk 'BEGIN { FS = " -> " } ; { print $2 }'` n_links_followed=$[$n_links_followed+1] @@ -90,7 +90,7 @@ function resolve_symlinks { fi } -# Before calling this function set the varible quoted_absolute_path +# Before calling this function set the varible quoted_absolute_path # to the best guess of the absolute path. eg: quoted_absolute_path="$0" # Upon error : quoted_absolute_path is set to -30 # You should check for this instance a loop has occoured with the links @@ -102,9 +102,9 @@ function get_absolute_path { if [ "$dot_slash_test" != "" ] ; then quoted_absolute_path=`basename $quoted_absolute_path` fi - + # find absolute path (parent path times ".." will not be striped path items) - quoted_absolute_path=$(echo $quoted_absolute_path | grep '^/' || echo `pwd`/$quoted_absolute_path) + quoted_absolute_path=$(echo $quoted_absolute_path | grep '^/' || echo `pwd`/$quoted_absolute_path) # Reset Link Counter n_links_followed=0 # Check if there are any symlinks @@ -112,24 +112,24 @@ function get_absolute_path { } function check_mail_configuration_exists { - # Check file specified exists and is a lbackup command file. - if ! [ -f "$mailConfigurationFilePath" ] ; then + # Check file specified exists and is a lbackup command file. + if ! [ -f "$mailConfigurationFilePath" ] ; then echo 1>&2 "ERROR! : Specified configuration file dose not exist" echo " Configeration File Referenced : $mailConfigurationFilePath" exit -128 fi -} +} ################################## ## Initial Check ## ################################## -# Backup Using ($1) +# Backup Using ($1) # Make sure a file has been passed in on the command line if [ $# -ne 1 ]; then echo 1>&2 Usage: /usr/local/sbin/lmail configuration_file.conf exit -127 fi - + ################################## ## Pre Loaded Settings ## @@ -151,10 +151,10 @@ mail_post_action_script="" # symbolic link, bash should auto drefernce when # executing, provided the link is intact. # this section will need a clean up. -# +# # For now the sybolic link checking code is # good for debuging. And will detect any -# broken symbolic links +# broken symbolic links echo "Loading Mail Script Configuration Data..." @@ -166,7 +166,7 @@ export mailConfigurationFolderPath=`dirname "$mailConfigurationFilePath"` # check file exists after following symbolic links # note this is currently the only place this function is called from -check_mail_configuration_exists +check_mail_configuration_exists # Check mail file configuration file is an absolute or relaive path @@ -207,7 +207,7 @@ quoted_absolute_path=$0; get_absolute_path currentfilepath=$quoted_absolute_path currentdir=`dirname "$currentfilepath"` -# Set The Utilities Directory Absolute Path +# Set The Utilities Directory Absolute Path utilitiesdir="$currentdir""/""$utilities_folder_name" # Internal Configuration @@ -247,7 +247,7 @@ maillog_status="SUCCESS" ############################## # Check script return codes file exists. -if ! [ -f "$script_return_codes" ] ; then +if ! [ -f "$script_return_codes" ] ; then echo 1>&2 "ERROR! : Script Return Codes can not be loaded" echo " File Referenced : $script_return_codes" exit -127 @@ -279,42 +279,42 @@ fi # Perform Pre Action Scripts if [ -s "${mail_pre_action}" -a -x "${mail_pre_action}" ] ; then - + echo "Checking for Pre Action Scripts..." - + # Export Appropriate varibles to the scripts export mailConfigurationFolderPath # should have been done previousely anyway - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Execute the Pre Backup Actions (passing all pararmeters passed to the script) "${mail_pre_action}" $* - + # Store the Exit Value from the Pre Mail Script mail_pre_action_exit_value=$? - + if [ ${mail_pre_action_exit_value} == ${SCRIPT_SUCCESS} ] ; then # Set Pre Mail Script Success Flag pre_mail_script_status="SUCCESS" else # Determin weather to proceed with the backup - if [ ${mail_pre_action_exit_value} == ${SCRIPT_HALT} ] ; then - echo 1>&2 "ERROR! : Pre Mail Log Action Script Failed : Mail Log Aborted" + if [ ${mail_pre_action_exit_value} == ${SCRIPT_HALT} ] ; then + echo 1>&2 "ERROR! : Pre Mail Log Action Script Failed : Mail Log Aborted" send_mail_log exit ${SCRIPT_HALT} fi # Check for other exit codes - if [ ${mail_pre_action_exit_value} == ${SCRIPT_WARNING} ] ; then - echo 1>&2 "WARNING! : Pre Mail Log Action Resulted in Warning : Mail Log Continuing..." + if [ ${mail_pre_action_exit_value} == ${SCRIPT_WARNING} ] ; then + echo 1>&2 "WARNING! : Pre Mail Log Action Resulted in Warning : Mail Log Continuing..." else # Report Undefined Exit Value - echo 1>&2 "WARNING! : Undefined Pre Action Exit Value : ${mail_pre_action_exit_value}" - echo 1>&2 " Mail Log Continuing..." + echo 1>&2 "WARNING! : Undefined Pre Action Exit Value : ${mail_pre_action_exit_value}" + echo 1>&2 " Mail Log Continuing..." fi - fi + fi fi @@ -348,7 +348,7 @@ fi if ! [ -d $logFileArchive ] ; then echo "Creating Log Archive" mkdir $logFileArchive - if [ $? != 0 ] ; then + if [ $? != 0 ] ; then newerr="Error : Problem creating log archive folder" err="$err""$newerr" fi @@ -376,7 +376,7 @@ fi ########################## ## Error Detection ## -########################## +########################## detected_error=`cat $logFileCurrentArchive | $utilitiesdir/checklog.py -s` @@ -397,7 +397,7 @@ else echo " Log file contains erors or warnings" echo " Appropriate mail template : mail_logerror_attachment.sh" mail_template="$template_path""/""mail_logerror_attachhment.sh" - else + else mail_template="$template_path""/""mail_standard_attachhment.sh" fi fi @@ -408,39 +408,39 @@ fi ## Send Email ## ########################## -echo "mail system is : $mailsystem" +echo "mail system is : $mailsystem" echo "Checking if Local" if [ "$mailsystem" == "SSH" ] ; then - + mailsystem_specified="YES" - + echo "$attachmentFile" | $mail_template "$messageContent" "$backup_identity" "$attachmentName" | ssh $sshUser@$sshServer "/usr/sbin/sendmail $messageRecipient" - + if [ $? != 0 ] ; then - mailsent="NO" + mailsent="NO" else mailsent="YES" fi -fi +fi if [ "$mailsystem" == "LOCAL" ] ; then - + mailsystem_specified="YES" #echo "$messageRecipient" > /Volumes/External\ 30GIG/message2besent.txt echo "$attachmentFile" | $mail_template "$messageContent" "$backup_identity" "$attachmentName" | /usr/sbin/sendmail $messageRecipient - + if [ $? != 0 ] ; then mailsent="NO" else mailsent="YES" fi -fi +fi if [ "$mailsystem_specified" == "NO" ] ; then - echo 'ERROR : incorrect mail system type spcified (SSH, LOCAL)' | tee -ai + echo 'ERROR : incorrect mail system type spcified (SSH, LOCAL)' | tee -ai fi @@ -453,39 +453,39 @@ fi # Perform Post Action Scripts if [ -s "${mail_post_action}" -a -x "${mail_post_action}" ] ; then - + echo "Checking for Post Action Scripts..." - + # Export Appropriate varibles to the scripts export mailConfigurationFolderPath # should have been done previousely anyway - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Execute the Post Mail Actions (passing all pararmeters passed to the script) "${mail_post_action}" $* - + # Store the Exit Value from the Pre Backup Script mail_post_action_exit_value=$? - - - if [ ${mail_post_action_exit_value} != ${SCRIPT_SUCCESS} ] ; then - + + + if [ ${mail_post_action_exit_value} != ${SCRIPT_SUCCESS} ] ; then + # Determin weather script errors should be reported ( this will affect backup success status ) - if [ ${mail_post_action_exit_value} == ${SCRIPT_HALT} ] ; then - echo 1>&2 "ERROR! : Post Mail Log Action Script Failed : MailLog Aborted Requested" + if [ ${mail_post_action_exit_value} == ${SCRIPT_HALT} ] ; then + echo 1>&2 "ERROR! : Post Mail Log Action Script Failed : MailLog Aborted Requested" maillog_status="FIALED" fi - + # Check for Warning exit codes - if [ ${mail_post_action_exit_value} == ${SCRIPT_WARNING} ] ; then - echo 1>&2 "WARNING! : Post Mail Log Action Resulted in Warning : Backup Continuing..." + if [ ${mail_post_action_exit_value} == ${SCRIPT_WARNING} ] ; then + echo 1>&2 "WARNING! : Post Mail Log Action Resulted in Warning : Backup Continuing..." else # Report Undefined Exit Value - echo 1>&2 "WARNING! : Undefined Post Action Exit Value : ${mail_post_action_exit_value}" - echo 1>&2 " Mail Log Continuing..." + echo 1>&2 "WARNING! : Undefined Post Action Exit Value : ${mail_post_action_exit_value}" + echo 1>&2 " Mail Log Continuing..." fi fi fi @@ -500,6 +500,6 @@ if [ "$maillog_status" == "SUCCESS" ] ; then echo "Mail Spooled Successfully" else echo "Mail Spooled Successfully, However Post Mail Log Actions Failed" -fi +fi exit 0 diff --git a/usr/local/libexec/lbackup1001/interfaces/lbackup_change_directory.bash b/usr/local/libexec/lbackup1001/interfaces/lbackup_change_directory.bash index c7cc5d4..05a9be1 100755 --- a/usr/local/libexec/lbackup1001/interfaces/lbackup_change_directory.bash +++ b/usr/local/libexec/lbackup1001/interfaces/lbackup_change_directory.bash @@ -20,7 +20,7 @@ skip_alias_check="NO" # for parsing arguments when running via the source command if [ $# -gt 1 ] ; then - if [ "${1}" == "-s" ] ; then + if [ "${1}" == "-s" ] ; then skip_alias_check="YES" else echo "" @@ -37,12 +37,12 @@ fi direction=${1} function change_directory { - - # Check we are aliased + + # Check we are aliased alias_result=`alias | grep -e "^alias lcd="` if [ "${alias_result}" == "" ] && [ "${skip_alias_check}" == "NO" ] ; then echo "" - echo "In order for this tool to function correctly, it should be" + echo "In order for this tool to function correctly, it should be" echo "executed via the built-in \"source\" command." echo "" echo "If you are using the BASH shell, then execute the command" @@ -59,7 +59,7 @@ function change_directory { return -127 #exit -127 fi - + current_section=`echo $PWD | awk -F "/Section." '{print $2}' | awk -F "/" '{print $1}'` if [ "${current_section}" == "" ] ; then echo "ERROR!: Unable to detect any backups sets within the current working directory." @@ -68,19 +68,19 @@ function change_directory { return -127 #exit -127 fi - - + + if [ "${direction}" == "back" ] || [ "${direction}" == "older" ] || [ "${direction}" == "past" ] || [ "${direction}" == "newer" ] || [ "${direction}" == "future" ] || [ "${direction}" == "forward" ] ; then - + destination_section=${current_section} backup_directory="`echo $PWD | awk -F "/Section." '{print $1}'`/" oldest_backup_section=`ls "${backup_directory}" | grep -e "^Section." | awk -F "Section." '{print$2}' | sort -n | tail -n 1` most_recent_backup_section=`ls "${backup_directory}" | grep -e "^Section." | awk -F "Section." '{print$2}' | sort -n | head -n 1` - - + + # Moving Forward in time if [ "${direction}" == "future" ] || [ "${direction}" == "forward" ] || [ "${direction}" == "newer" ] ; then - if [ ${current_section} -gt $most_recent_backup_section ] ; then + if [ ${current_section} -gt $most_recent_backup_section ] ; then # (( destination_section -- )) destination_section=`echo "${destination_section}-1" | bc` else @@ -88,10 +88,10 @@ function change_directory { return -127 #exit -127 fi - + fi - - + + # Moving Back in time if [ "${direction}" == "back" ] || [ "${direction}" == "past" ] || [ "${direction}" == "older" ] ; then if [ ${current_section} -lt $oldest_backup_section ] ; then @@ -103,17 +103,17 @@ function change_directory { #exit -127 fi fi - - # Make some modifications to the current working current working directory so that we can find the destination directory, which we plan to move to. + + # Make some modifications to the current working current working directory so that we can find the destination directory, which we plan to move to. new_directory=`echo "$PWD" | awk '{sub(/Section.'$current_section'/,"Section.'$destination_section'")}; 1'` - + if [ -d "${new_directory}" ] ; then cd "${new_directory}" if [ $? != 0 ] ; then echo "ERROR! : Unable to move to the destination directory?" echo " ${new_directory}" return -127 - #exit -127 + #exit -127 fi else echo "ERROR! : The destination directory is no longer available." @@ -121,21 +121,21 @@ function change_directory { return -127 #exit -127 fi - - + + else - + echo "Usage examples : " echo " Move to a more recent backup: . /usr/local/sbin/lcd future" echo " Move to an older backup: . /usr/local/sbin/lcd past" return -127 - #exit -1 - + #exit -1 + fi - + return 0 #exit 0 - + } change_directory diff --git a/usr/local/libexec/lbackup1001/maillog_script.bash b/usr/local/libexec/lbackup1001/maillog_script.bash index 2785c6a..7f2d736 100755 --- a/usr/local/libexec/lbackup1001/maillog_script.bash +++ b/usr/local/libexec/lbackup1001/maillog_script.bash @@ -20,12 +20,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## ## ## Lucid Information Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid terms and conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## ## @@ -83,7 +83,7 @@ messageRecipient_example_configuration_value="recipient.name@recipient.domain.co ######################## ## Internal Functions ## -######################## +######################## # Function is used by get_absolute_path function @@ -92,7 +92,7 @@ messageRecipient_example_configuration_value="recipient.name@recipient.domain.co # Called by the get_absolute_path funtion function resolve_symlinks { # Check if it is an alias - if [ -L "$quoted_absolute_path" ] ; then + if [ -L "$quoted_absolute_path" ] ; then # # If Alias then find where the alias is pointing quoted_absolute_path=`ls -l "$quoted_absolute_path" | awk 'BEGIN { FS = " -> " } ; { print $2 }'` n_links_followed=$[$n_links_followed+1] @@ -105,7 +105,7 @@ function resolve_symlinks { fi } -# Before calling this function set the varible quoted_absolute_path +# Before calling this function set the varible quoted_absolute_path # to the best guess of the absolute path. eg: quoted_absolute_path="$0" # Upon error : quoted_absolute_path is set to -30 # You should check for this instance a loop has occoured with the links @@ -117,9 +117,9 @@ function get_absolute_path { if [ "$dot_slash_test" != "" ] ; then quoted_absolute_path=`basename $quoted_absolute_path` fi - + # find absolute path (parent path times ".." will not be striped path items) - quoted_absolute_path=$(echo $quoted_absolute_path | grep '^/' || echo `pwd`/$quoted_absolute_path) + quoted_absolute_path=$(echo $quoted_absolute_path | grep '^/' || echo `pwd`/$quoted_absolute_path) # Reset Link Counter n_links_followed=0 # Check if there are any symlinks @@ -127,24 +127,24 @@ function get_absolute_path { } function check_mail_configuration_exists { - # Check file specified exists and is a lbackup command file. - if ! [ -f "$mailConfigurationFilePath" ] ; then + # Check file specified exists and is a lbackup command file. + if ! [ -f "$mailConfigurationFilePath" ] ; then echo 1>&2 "ERROR! : Specified configuration file dose not exist" echo " Configuration File Referenced : $mailConfigurationFilePath" exit -128 fi -} +} ################################## ## Initial Check ## ################################## -# Backup Using ($1) +# Backup Using ($1) # Make sure a file has been passed in on the command line if [ $# -ne 1 ]; then echo 1>&2 Usage: /usr/local/sbin/lmail configuration_file.conf exit -127 fi - + ################################## ## Pre Loaded Settings ## @@ -166,10 +166,10 @@ mail_post_action_script="" # symbolic link, bash should auto drefernce when # executing, provided the link is intact. # this section will need a clean up. -# +# # For now the sybolic link checking code is # good for debuging. And will detect any -# broken symbolic links +# broken symbolic links echo "Loading Mail Script Configuration Data..." @@ -181,7 +181,7 @@ export mailConfigurationFolderPath=`dirname "$mailConfigurationFilePath"` # check file exists after following symbolic links # note this is currently the only place this function is called from -check_mail_configuration_exists +check_mail_configuration_exists # Check mail file configuration file is an absolute or relaive path @@ -222,7 +222,7 @@ quoted_absolute_path=$0; get_absolute_path currentfilepath=$quoted_absolute_path currentdir=`dirname "$currentfilepath"` -# Set The Utilities Directory Absolute Path +# Set The Utilities Directory Absolute Path utilitiesdir="$currentdir""/""$utilities_folder_name" # Internal Configuration @@ -231,7 +231,7 @@ utilitiesdir="$currentdir""/""$utilities_folder_name" if [ "${enableCustomMailTemplates}" == "YES" ] ; then # Check for a directory or symlink to the mail template folder template_path="${mailConfigurationFolderPath}/resources/${template_folder_name}" - if [ -d "${template_path}" ] || [ -L "${template_path}" ] ; then + if [ -d "${template_path}" ] || [ -L "${template_path}" ] ; then # Check for the required mail templates required_tamplates="mail_logerror_attachment.sh mail_standard_attachment.sh mail_standard.sh mail_error.sh" for mail_template_name in $required_tamplates ; do @@ -260,8 +260,8 @@ if [ "${enableCustomMailTemplates}" == "YES" ] ; then fi fi -# Actually configure the mail template directory -if [ "${enableCustomMailTemplates}" == "YES" ] ; then +# Actually configure the mail template directory +if [ "${enableCustomMailTemplates}" == "YES" ] ; then # All required tamplate components are availible and it has been enabled in the configuration file, # so use the custom mail template folder. template_path="$mailConfigurationFolderPath""/""$template_folder_name" @@ -306,7 +306,7 @@ maillog_status="SUCCESS" ############################## # Check script return codes file exists. -if ! [ -f "$script_return_codes" ] ; then +if ! [ -f "$script_return_codes" ] ; then echo 1>&2 "ERROR! : Script Return Codes can not be loaded" echo " File Referenced : $script_return_codes" exit -127 @@ -352,42 +352,42 @@ fi # Perform Pre Action Scripts if [ -s "${mail_pre_action}" -a -x "${mail_pre_action}" ] ; then - + echo "Checking for Pre Action Scripts..." - + # Export Appropriate varibles to the scripts export mailConfigurationFolderPath # should have been done previousely anyway - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Execute the Pre Backup Actions (passing all pararmeters passed to the script) "${mail_pre_action}" $* - + # Store the Exit Value from the Pre Mail Script mail_pre_action_exit_value=$? - + if [ ${mail_pre_action_exit_value} == ${SCRIPT_SUCCESS} ] ; then # Set Pre Mail Script Success Flag pre_mail_script_status="SUCCESS" else # Determin weather to proceed with the backup - if [ ${mail_pre_action_exit_value} == ${SCRIPT_HALT} ] ; then - echo 1>&2 "ERROR! : Pre Mail Log Action Script Failed : Mail Log Aborted" + if [ ${mail_pre_action_exit_value} == ${SCRIPT_HALT} ] ; then + echo 1>&2 "ERROR! : Pre Mail Log Action Script Failed : Mail Log Aborted" send_mail_log exit ${SCRIPT_HALT} fi # Check for other exit codes - if [ ${mail_pre_action_exit_value} == ${SCRIPT_WARNING} ] ; then - echo 1>&2 "WARNING! : Pre Mail Log Action Resulted in Warning : Mail Log Continuing..." + if [ ${mail_pre_action_exit_value} == ${SCRIPT_WARNING} ] ; then + echo 1>&2 "WARNING! : Pre Mail Log Action Resulted in Warning : Mail Log Continuing..." else # Report Undefined Exit Value - echo 1>&2 "WARNING! : Undefined Pre Action Exit Value : ${mail_pre_action_exit_value}" - echo 1>&2 " Mail Log Continuing..." + echo 1>&2 "WARNING! : Undefined Pre Action Exit Value : ${mail_pre_action_exit_value}" + echo 1>&2 " Mail Log Continuing..." fi - fi + fi fi @@ -421,7 +421,7 @@ fi if ! [ -d $logFileArchive ] ; then echo "Creating Log Archive" mkdir $logFileArchive - if [ $? != 0 ] ; then + if [ $? != 0 ] ; then newerr="Error : Problem creating log archive folder" err="$err""$newerr" fi @@ -449,7 +449,7 @@ fi ########################## ## Error Detection ## -########################## +########################## detected_error=`cat $logFileCurrentArchive | $utilitiesdir/checklog.py -s` @@ -470,7 +470,7 @@ else echo " Log file contains errors or warnings" echo " Appropriate mail template : mail_logerror_attachment.sh" mail_template="$template_path""/""mail_logerror_attachment.sh" - else + else mail_template="$template_path""/""mail_standard_attachment.sh" fi fi @@ -481,35 +481,35 @@ fi ## Send Email ## ########################## -echo "mail system is : $mailsystem" +echo "mail system is : $mailsystem" echo "Checking if Local" if [ "$mailsystem" == "SSH" ] ; then - + mailsystem_specified="YES" - + echo "$attachmentFile" | $mail_template "$messageContent" "$backup_identity" "$messageFromName" "$messageFromAddress" "$messageRecipient" "$attachmentName" | ssh $sshUser@$sshServer "/usr/sbin/sendmail -f $messageFromAddress $messageRecipient" - + if [ $? != 0 ] ; then - mailsent="NO" + mailsent="NO" else mailsent="YES" fi -fi +fi if [ "$mailsystem" == "LOCAL" ] ; then - + mailsystem_specified="YES" #echo "$messageRecipient" > /Volumes/External\ 30GIG/message2besent.txt echo "$attachmentFile" | $mail_template "$messageContent" "$backup_identity" "$messageFromName" "$messageFromAddress" "$messageRecipient" "$attachmentName" | /usr/sbin/sendmail -f $messageFromAddress $messageRecipient - + if [ $? != 0 ] ; then mailsent="NO" else mailsent="YES" fi -fi +fi if [ "$mailsystem_specified" == "NO" ] ; then @@ -526,39 +526,39 @@ fi # Perform Post Action Scripts if [ -s "${mail_post_action}" -a -x "${mail_post_action}" ] ; then - + echo "Checking for Post Action Scripts..." - + # Export Appropriate varibles to the scripts export mailConfigurationFolderPath # should have been done previousely anyway - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Execute the Post Mail Actions (passing all pararmeters passed to the script) "${mail_post_action}" $* - + # Store the Exit Value from the Pre Backup Script mail_post_action_exit_value=$? - - - if [ ${mail_post_action_exit_value} != ${SCRIPT_SUCCESS} ] ; then - + + + if [ ${mail_post_action_exit_value} != ${SCRIPT_SUCCESS} ] ; then + # Determin weather script errors should be reported ( this will affect backup success status ) - if [ ${mail_post_action_exit_value} == ${SCRIPT_HALT} ] ; then - echo 1>&2 "ERROR! : Post Mail Log Action Script Failed : MailLog Aborted Requested" + if [ ${mail_post_action_exit_value} == ${SCRIPT_HALT} ] ; then + echo 1>&2 "ERROR! : Post Mail Log Action Script Failed : MailLog Aborted Requested" maillog_status="FIALED" fi - + # Check for Warning exit codes - if [ ${mail_post_action_exit_value} == ${SCRIPT_WARNING} ] ; then - echo 1>&2 "WARNING! : Post Mail Log Action Resulted in Warning : Backup Continuing..." + if [ ${mail_post_action_exit_value} == ${SCRIPT_WARNING} ] ; then + echo 1>&2 "WARNING! : Post Mail Log Action Resulted in Warning : Backup Continuing..." else # Report Undefined Exit Value - echo 1>&2 "WARNING! : Undefined Post Action Exit Value : ${mail_post_action_exit_value}" - echo 1>&2 " Mail Log Continuing..." + echo 1>&2 "WARNING! : Undefined Post Action Exit Value : ${mail_post_action_exit_value}" + echo 1>&2 " Mail Log Continuing..." fi fi fi @@ -573,7 +573,7 @@ if [ "$maillog_status" == "SUCCESS" ] ; then echo "Mail Spooled Successfully" else echo "Mail Spooled Successfully, However Post Mail Log Actions Failed" -fi +fi exit 0 diff --git a/usr/local/libexec/lbackup1001/message_templates/mail_error.sh b/usr/local/libexec/lbackup1001/message_templates/mail_error.sh index 5c4d309..b11b90a 100755 --- a/usr/local/libexec/lbackup1001/message_templates/mail_error.sh +++ b/usr/local/libexec/lbackup1001/message_templates/mail_error.sh @@ -37,7 +37,7 @@ version="1.3" ########################## cdateLOCAL=`date` -cdateGMT=`date -u` +cdateGMT=`date -u` reportDate="$cdateLOCAL" ########################## @@ -59,7 +59,7 @@ echo "X-Lucid-Report: Mail-Error" echo "" echo "Lucid Backup Report $reportDate" echo "" -echo "$backup_identity" +echo "$backup_identity" echo "Error occurred during backup report generation." echo "$messageContent" echo "" diff --git a/usr/local/libexec/lbackup1001/message_templates/mail_logerror_attachment.sh b/usr/local/libexec/lbackup1001/message_templates/mail_logerror_attachment.sh index 62a4a2e..a8e87e9 100755 --- a/usr/local/libexec/lbackup1001/message_templates/mail_logerror_attachment.sh +++ b/usr/local/libexec/lbackup1001/message_templates/mail_logerror_attachment.sh @@ -42,7 +42,7 @@ version="1.3" cdateLOCAL=`date` cdateGMT=`date -u` -reportDate="$cdateLOCAL" +reportDate="$cdateLOCAL" # Select the correct MD5 system @@ -67,8 +67,8 @@ boundary="mail-boundary-marker.""$marker" echo "User-Agent: Lucid-Reporting-$version" echo 'Content-Type: multipart/mixed; boundary="'$boundary'";' echo "MIME-Version: 1.0" - echo "X-Priority: 1" - echo "X-MSMail-Priority: High" + echo "X-Priority: 1" + echo "X-MSMail-Priority: High" echo "X-Lucid-Report: Error-Detected" echo "" echo "" diff --git a/usr/local/libexec/lbackup1001/message_templates/mail_standard.sh b/usr/local/libexec/lbackup1001/message_templates/mail_standard.sh index 644bebf..cd09374 100755 --- a/usr/local/libexec/lbackup1001/message_templates/mail_standard.sh +++ b/usr/local/libexec/lbackup1001/message_templates/mail_standard.sh @@ -37,7 +37,7 @@ version="1.3" cdateLOCAL=`date` cdateGMT=`date -u` -reportDate="$cdateLOCAL" +reportDate="$cdateLOCAL" ########################## ## Generate Email ## @@ -58,7 +58,7 @@ echo "X-Lucid-Report: Backup-Success" echo "" echo "Lucid Backup Report $reportDate" echo "" -echo "$backup_identity" +echo "$backup_identity" echo "Backup Reporting was successful, check log below for details" echo "" echo "" diff --git a/usr/local/libexec/lbackup1001/message_templates/mail_standard_attachment.sh b/usr/local/libexec/lbackup1001/message_templates/mail_standard_attachment.sh index 4952da1..48ce50e 100755 --- a/usr/local/libexec/lbackup1001/message_templates/mail_standard_attachment.sh +++ b/usr/local/libexec/lbackup1001/message_templates/mail_standard_attachment.sh @@ -40,7 +40,7 @@ version="1.3" cdateLOCAL=`date` cdateGMT=`date -u` -reportDate="$cdateLOCAL" +reportDate="$cdateLOCAL" # Select the correct MD5 system diff --git a/usr/local/libexec/lbackup1001/todo b/usr/local/libexec/lbackup1001/todo index 2675b92..3881421 100644 --- a/usr/local/libexec/lbackup1001/todo +++ b/usr/local/libexec/lbackup1001/todo @@ -1,7 +1,7 @@ Development Options -Verification of data. +Verification of data. Tool to carry out tree pruning and removal @@ -19,21 +19,21 @@ should automatically update depending upon the version being installed. SSH port number support (not high priority due to the ssh config file) -SSH key specification support +SSH key specification support (not high priority due to the ssh config file) Build Better Configuration File System further configuration file architecture further configuration file implementation -Finish Installer : with new install locations : +Finish Installer : with new install locations : -FROM : INSTALL LOCATIONS FILE : +FROM : INSTALL LOCATIONS FILE : InstallBinary into > /usr/local/libexec/ Executiles Folder: lbackup1001/ lbackup1 > backup1001 lbackup > lbackup1 - + Link for Execution into > /usr/local/sbin/ lbackup > /usr/local/libexec/lbackup/lbackup.bash @@ -42,5 +42,4 @@ Link for Execution into > /usr/local/sbin/ This Installer is going to have to unlink previous versions and re-link the current version. - - \ No newline at end of file + diff --git a/usr/local/libexec/lbackup1001/utilities/base64encode.py b/usr/local/libexec/lbackup1001/utilities/base64encode.py index aa1b475..997dc26 100755 --- a/usr/local/libexec/lbackup1001/utilities/base64encode.py +++ b/usr/local/libexec/lbackup1001/utilities/base64encode.py @@ -19,12 +19,12 @@ ## ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## import sys, base64 base64.encode (sys.stdin, sys.stdout) diff --git a/usr/local/libexec/lbackup1001/utilities/checklog.py b/usr/local/libexec/lbackup1001/utilities/checklog.py index 5b8c094..a723405 100755 --- a/usr/local/libexec/lbackup1001/utilities/checklog.py +++ b/usr/local/libexec/lbackup1001/utilities/checklog.py @@ -23,7 +23,7 @@ ########################## ## Serarch Terms ## -########################## +########################## parse1 = 'ERROR!' parse2 = 'WARNING!' @@ -34,7 +34,7 @@ ########################## ## Help File ## -########################## +########################## def usage(): @@ -48,7 +48,7 @@ def usage(): print " LogCheck will output one (1) if ether of" print ' these strings : ' + parse1 + ', ' + parse2 + ' are detected' print ' The output is zero (0) if neither these' - print ' strings are detected.' + print ' strings are detected.' print '' print ' options :' print ' -h --help display this help screen' @@ -57,26 +57,26 @@ def usage(): print '' print '' print ' example :' - print ' (1) logcheck.py -h' + print ' (1) logcheck.py -h' print ' displays this help message' print '' print ' (2) cat ~/log.txt | logcheck.py -s' print ' checks the file ~/log.txt' - print '' + print '' print ' (3) logcheck.py -f ~/log.txt' print' checks the file ~/log.txt' print '' print '' - + ########################## ## Internal Varibles ## -########################## +########################## # Detection Checking -seen = False +seen = False -# Standard Input Type +# Standard Input Type acceptStdin = False # File Input Type @@ -87,7 +87,7 @@ def usage(): ########################## ## Options Check ## -########################## +########################## try: opts, args = getopt.getopt(sys.argv[1:], 'f:hs', ["help", "stdin"]) @@ -109,22 +109,22 @@ def usage(): ########################## ## Options Checking ## -########################## +########################## if acceptFilin and acceptStdin: print ' ERROR! : Only select one input source may be selected at a time' print ' Help is availible by typing "checklog -h"' sys.exit(-1) - + if not ( acceptFilin or acceptStdin) : print ' ERROR! : At minium one input source must be selected' print ' Help is availible by typing "checklog -h"' sys.exit(-1) - + ########################## ## Set Input ## -########################## +########################## if ( acceptStdin == True ): lines = sys.stdin @@ -137,17 +137,16 @@ def usage(): ########################## ## Check for Lines ## -########################## +########################## for line in lines: - seen = (string.find (line, parse1) >= 0) + seen = (string.find (line, parse1) >= 0) if seen : print 1 sys.exit() - seen = (string.find (line, parse2) >= 0) + seen = (string.find (line, parse2) >= 0) if seen : print 1 - sys.exit() -print 0 - - \ No newline at end of file + sys.exit() +print 0 + diff --git a/usr/local/libexec/lbackup1001/utilities/default_scripts/default_backup_post_action.bash b/usr/local/libexec/lbackup1001/utilities/default_scripts/default_backup_post_action.bash index 626c7bf..2d55b91 100755 --- a/usr/local/libexec/lbackup1001/utilities/default_scripts/default_backup_post_action.bash +++ b/usr/local/libexec/lbackup1001/utilities/default_scripts/default_backup_post_action.bash @@ -20,12 +20,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## distributed under liecence from ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## @@ -48,17 +48,17 @@ ACTION_PREFIX="BACKUP" # Export Appropriate varibles to the scripts export logFile # pre scripts have the ability to write data to the log file export backupConfigurationFolderPath # should have been done previousely anyway - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Export Script Varibles export ACTION_DIRECTORY export ACTION_PREFIX - - + + ################################# ## INTERNAL VARIBLES ## @@ -76,46 +76,46 @@ final_exit_value=${SCRIPT_SUCCESS} # Directory Check if [ -d "${ACTION_DIRECTORY}" ]; then - + # Perform valid actions with valid prefix for action in "${ACTION_DIRECTORY}/${ACTION_PREFIX}"* ; do - + # Check Action is Executable if [ -s "${action}" -a -x "${action}" ]; then - + # Export this actions name action_name=`basename "${action}"` export action_name - + # Write Post Backup Action Detils to Log echo "Performing Post-Action : ${action_name}" | tee -ai $logFile - + # Perform Action, passing all command line arguments - + # =================================================== # "${action}" $* action_exit_value=$? # =================================================== # - + # Check the Action Succeded if [ ${action_exit_value} != ${SCRIPT_SUCCESS} ]; then - + # Check for "Halt" Exit Value if [ ${action_exit_value} == ${SCRIPT_HALT} ]; then final_exit_value=${SCRIPT_HALT} # Stop Executing Actions exit ${final_exit_value} fi - + # Check for "Warning" Exit Value if [ ${action_exit_value} == ${SCRIPT_WARNING} ]; then # Store Warning Value for Return (Unless a Hault Value is Found Later) - final_exit_value=${SCRIPT_WARNING} + final_exit_value=${SCRIPT_WARNING} else # If the exit value is not HALT, WARNING or SUCCESS, report the last odd exit value final_exit_value=${action_exit_value} - fi - fi + fi + fi fi done fi diff --git a/usr/local/libexec/lbackup1001/utilities/default_scripts/default_backup_pre_action.bash b/usr/local/libexec/lbackup1001/utilities/default_scripts/default_backup_pre_action.bash index 8f436a4..740a5ff 100755 --- a/usr/local/libexec/lbackup1001/utilities/default_scripts/default_backup_pre_action.bash +++ b/usr/local/libexec/lbackup1001/utilities/default_scripts/default_backup_pre_action.bash @@ -20,12 +20,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## distributed under liecence from ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## @@ -47,12 +47,12 @@ ACTION_PREFIX="BACKUP" # Export Appropriate varibles to the scripts export logFile # pre scripts have the ability to write data to the log file export backupConfigurationFolderPath # should have been done previousely anyway - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Export Script Varibles export ACTION_DIRECTORY export ACTION_PREFIX @@ -72,46 +72,46 @@ final_exit_value=${SCRIPT_SUCCESS} # Directory Check if [ -d "${ACTION_DIRECTORY}" ]; then - + # Perform valid actions with valid prefix for action in "${ACTION_DIRECTORY}/${ACTION_PREFIX}"* ; do - + # Check Action is Executable if [ -s "${action}" -a -x "${action}" ]; then - + # Export this actions name action_name=`basename "${action}"` export action_name - + # Write Pre Backup Action Detils to Log echo "Performing Pre-Action : ${action_name}" | tee -ai $logFile - + # Perform Action, passing all command line arguments - + # =================================================== # "${action}" $* action_exit_value=$? # =================================================== # - + # Check the Action Succeded if [ ${action_exit_value} != ${SCRIPT_SUCCESS} ]; then - + # Check for "Halt" Exit Value if [ ${action_exit_value} == ${SCRIPT_HALT} ]; then final_exit_value=${SCRIPT_HALT} # Stop Executing Actions exit ${final_exit_value} fi - + # Check for "Warning" Exit Value if [ ${action_exit_value} == ${SCRIPT_WARNING} ]; then # Store Warning Value for Return (Unless a Hault Value is Found Later) - final_exit_value=${SCRIPT_WARNING} + final_exit_value=${SCRIPT_WARNING} else # If the exit value is not HALT, WARNING or SUCCESS, report the last odd exit value final_exit_value=${action_exit_value} fi - fi + fi fi done fi diff --git a/usr/local/libexec/lbackup1001/utilities/default_scripts/default_mail_post_action.bash b/usr/local/libexec/lbackup1001/utilities/default_scripts/default_mail_post_action.bash index ac42b50..6e6c80f 100755 --- a/usr/local/libexec/lbackup1001/utilities/default_scripts/default_mail_post_action.bash +++ b/usr/local/libexec/lbackup1001/utilities/default_scripts/default_mail_post_action.bash @@ -20,12 +20,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## distributed under liecence from ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## @@ -47,17 +47,17 @@ ACTION_PREFIX="MAIL" # Export Appropriate varibles to the scripts export backupConfigurationFolderPath # should have been done previousely anyway - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Export Script Varibles export ACTION_DIRECTORY export ACTION_PREFIX - - + + ################################# ## INTERNAL VARIBLES ## @@ -74,46 +74,46 @@ final_exit_value=${SCRIPT_SUCCESS} # Directory Check if [ -d "${ACTION_DIRECTORY}" ]; then - + # Perform valid actions with valid prefix for action in "${ACTION_DIRECTORY}/${ACTION_PREFIX}"* ; do - + # Check Action is Executable if [ -s "${action}" -a -x "${action}" ]; then - + # Export this actions name action_name=`basename "${action}"` export action_name - + # Write Post Mail Action Detils to Log echo "Performing Post-Action : ${action_name}" | tee -ai $logFile - + # Perform Action, passing all command line arguments - + # =================================================== # "${action}" $* action_exit_value=$? # =================================================== # - + # Check the Action Succeded if [ ${action_exit_value} != ${SCRIPT_SUCCESS} ]; then - + # Check for "Halt" Exit Value if [ ${action_exit_value} == ${SCRIPT_HALT} ]; then final_exit_value=${SCRIPT_HALT} # Stop Executing Actions exit ${final_exit_value} fi - + # Check for "Warning" Exit Value if [ ${action_exit_value} == ${SCRIPT_WARNING} ]; then # Store Warning Value for Return (Unless a Hault Value is Found Later) - final_exit_value=${SCRIPT_WARNING} + final_exit_value=${SCRIPT_WARNING} else # If the exit value is not HALT, WARNING or SUCCESS, report the last odd exit value final_exit_value=${action_exit_value} fi - fi + fi fi done fi diff --git a/usr/local/libexec/lbackup1001/utilities/default_scripts/default_mail_pre_action.bash b/usr/local/libexec/lbackup1001/utilities/default_scripts/default_mail_pre_action.bash index ce689b8..9cc5b2e 100755 --- a/usr/local/libexec/lbackup1001/utilities/default_scripts/default_mail_pre_action.bash +++ b/usr/local/libexec/lbackup1001/utilities/default_scripts/default_mail_pre_action.bash @@ -20,12 +20,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## distributed under liecence from ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## @@ -47,16 +47,16 @@ ACTION_PREFIX="MAIL" # Export Appropriate varibles to the scripts export backupConfigurationFolderPath # should have been done previousely anyway - + # Export the Script Return Codes export SCRIPT_SUCCESS export SCRIPT_WARNING export SCRIPT_HALT - + # Export Script Varibles export ACTION_DIRECTORY export ACTION_PREFIX - + ################################# ## INTERNAL VARIBLES ## @@ -73,42 +73,42 @@ final_exit_value=${SCRIPT_SUCCESS} # Directory Check if [ -d "${ACTION_DIRECTORY}" ]; then - + # Perform valid actions with valid prefix for action in "${ACTION_DIRECTORY}/${ACTION_PREFIX}"* ; do - + # Check Action is Executable if [ -s "${action}" -a -x "${action}" ]; then - - + + # Export this actions name action_name=`basename "${action}"` export action_name - + # Write Pre Mail Action Detils to Log echo "Performing Pre-Action : ${action_name}" | tee -ai $logFile - + # Perform Action, passing all command line arguments - + # =================================================== # "${action}" $* action_exit_value=$? # =================================================== # - + # Check the Action Succeded if [ ${action_exit_value} != ${SCRIPT_SUCCESS} ]; then - + # Check for "Halt" Exit Value if [ ${action_exit_value} == ${SCRIPT_HALT} ]; then final_exit_value=${SCRIPT_HALT} # Stop Executing Actions exit ${final_exit_value} fi - + # Check for "Warning" Exit Value if [ ${action_exit_value} == ${SCRIPT_WARNING} ]; then # Store Warning Value for Return (Unless a Hault Value is Found Later) - final_exit_value=${SCRIPT_WARNING} + final_exit_value=${SCRIPT_WARNING} else # If the exit value is not HALT, WARNING or SUCCESS, report the last odd exit value final_exit_value=${action_exit_value} diff --git a/usr/local/libexec/lbackup1001/utilities/default_scripts/script_return_codes.conf b/usr/local/libexec/lbackup1001/utilities/default_scripts/script_return_codes.conf index 393e197..6e7a0a8 100755 --- a/usr/local/libexec/lbackup1001/utilities/default_scripts/script_return_codes.conf +++ b/usr/local/libexec/lbackup1001/utilities/default_scripts/script_return_codes.conf @@ -20,12 +20,12 @@ PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ## distributed under liecence from ## ## Lucid Inormatin Systems. ## ## ## -## The developer of this software ## +## The developer of this software ## ## maintains rights as specified in the ## ## Lucid Terms and Conditions availible from ## ## www.lucidsystems.org ## ## ## -################################################## +################################################## ######### Set Return Codes ######### diff --git a/usr/local/libexec/lbackup1001/utilities/initialization_scripts/darwin/initialize_disk_image_pre_and_post_hooks.bash b/usr/local/libexec/lbackup1001/utilities/initialization_scripts/darwin/initialize_disk_image_pre_and_post_hooks.bash index 3482d63..ef2a883 100755 --- a/usr/local/libexec/lbackup1001/utilities/initialization_scripts/darwin/initialize_disk_image_pre_and_post_hooks.bash +++ b/usr/local/libexec/lbackup1001/utilities/initialization_scripts/darwin/initialize_disk_image_pre_and_post_hooks.bash @@ -4,18 +4,18 @@ # Lucid Information Systems # Licensed under the GNU GPL -# This script will enable a pre and post action which will +# This script will enable a pre and post action which will # mount and unmount a disk image. Pass in the path to the disk image # as the first argument. # Version 1.2 # -# Version History +# Version History # 1.0 : Initial Release # 1.1 : Stops the script from being exectued within the example example_backup_config # 1.2 : Added in some basic comments to the header of this script packages to this script -# TO DO : (1) Add a function to convert realitve paths to actual paths possibly +# TO DO : (1) Add a function to convert realitve paths to actual paths possibly # by changing directory and then using the pwd command? # # (2) Additional testing of this script in various situations. @@ -76,12 +76,12 @@ fi # Check the operating system kind and version os_name=`uname` -if [ "${os_name}" != "Darwin" ] ; then +if [ "${os_name}" != "Darwin" ] ; then echo " ERROR! : This script only supports Mac OS X." exit -1 fi major_os_release=`uname -r | awk -F "." '{print $1}'` -if [ ${major_os_release} -le 7 ] ; then +if [ ${major_os_release} -le 7 ] ; then echo " ERROR! : This script only supports Mac OS 10.4 and higher." exit -1 fi @@ -136,7 +136,7 @@ if [ -f "${relative_example_dst_pre_action_mount_disk_image}" ] || [ -f "${relat fi # Check the disk image specified exists -if ! [ -e "${relative_path_to_disk_image}" ] ; then +if ! [ -e "${relative_path_to_disk_image}" ] ; then echo " ERROR!: Unable to locate the specified disk image" echo " \"${relative_path_to_disk_image}\"" exit -1 @@ -169,12 +169,12 @@ fi cp "${relative_example_src_pre_action_mount_disk_image}" "${relative_example_dst_pre_action_mount_disk_image}" if [ $? != 0 ] ; then echo "ERROR! : Unable to copy the pre action mount disk image script." - exit -1 + exit -1 fi cp "${relative_example_src_post_action_unmount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" if [ $? != 0 ] ; then echo "ERROR! : Unable to copy the post action unmount mount disk image script." - exit -1 + exit -1 fi @@ -189,14 +189,14 @@ tmp_file=`mktemp /tmp/lbackup_initialize_disk_image.XXXXXXXXX` # Replace the backup volume cat "${relative_example_dst_pre_action_mount_disk_image}" | sed 's!backupVolume=\"/Volumes/BackupDrive1\"!backupVolume=\"'${backup_volume}'"!' > "${tmp_file}" -if [ $? != 0 ] ; then +if [ $? != 0 ] ; then rm -f "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" echo " ERROR!: Unable to set the backup volume within the destination script." echo " Editing the backup volume failed." exit -1 fi mv "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" -if [ $? != 0 ] ; then +if [ $? != 0 ] ; then rm "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" echo " ERROR!: Unable to set the backup volume within the destination script." echo " Moving the edited file back into final destination." @@ -205,14 +205,14 @@ fi # Replace the backup volume cat "${relative_example_dst_pre_action_mount_disk_image}" | sed 's!imageVolumeName=\"/Volumes/backup_data_image\"!imageVolumeName=\"'${volume_mount_name}'"!' > "${tmp_file}" -if [ $? != 0 ] ; then +if [ $? != 0 ] ; then rm -f "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" echo " ERROR!: Unable to set the image volume name volume within the destination script." echo " Editing the backup volume failed." exit -1 fi mv "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" -if [ $? != 0 ] ; then +if [ $? != 0 ] ; then rm -f "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" echo " ERROR!: Unable to set the image volume name volume within the destination script." echo " Moving the edited file back into final destination." @@ -221,14 +221,14 @@ fi # Replace the image location cat "${relative_example_dst_pre_action_mount_disk_image}" | sed 's!imageVolumeLocation=\"/Volumes/BackupDrive1/backupimage.sparseimage\"!imageVolumeLocation=\"'${relative_path_to_disk_image}'"!' > "${tmp_file}" -if [ $? != 0 ] ; then +if [ $? != 0 ] ; then rm -f "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" echo " ERROR!: Unable to set the image location within the destination script." echo " Editing the backup volume failed." exit -1 fi mv "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" -if [ $? != 0 ] ; then +if [ $? != 0 ] ; then rm -f "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" echo " ERROR!: Unable to set the image location within the destination script." echo " Moving the edited file back into final destination." @@ -238,15 +238,15 @@ fi ## Edit the basic mount image script # Replace the backup volume cat "${relative_example_dst_post_action_unmount_disk_image}" | sed 's!volume_to_unmount=\"backup_mount\"!volume_to_unmount=\"'${volume_mount_name_no_pre_volume}'"!' > "${tmp_file}" -if [ $? != 0 ] ; then +if [ $? != 0 ] ; then rm -f "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" echo " ERROR!: Unable to set the backup volume within the destination script." echo " Editing the backup volume failed." exit -1 fi mv "${tmp_file}" "${relative_example_dst_post_action_unmount_disk_image}" -if [ $? != 0 ] ; then - rm -f "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" +if [ $? != 0 ] ; then + rm -f "${tmp_file}" "${relative_example_dst_pre_action_mount_disk_image}" "${relative_example_dst_post_action_unmount_disk_image}" echo " ERROR!: Unable to set the backup volume within the destination script." echo " Moving the edited file back into final destination." exit -1 @@ -299,7 +299,7 @@ echo " - post-action script : ${post_action_script_basename}" echo "" -#notes : +#notes : # attach options : -owners on diff --git a/usr/local/libexec/lbackup1001/utilities/wake.py b/usr/local/libexec/lbackup1001/utilities/wake.py index 4935743..581b7e9 100755 --- a/usr/local/libexec/lbackup1001/utilities/wake.py +++ b/usr/local/libexec/lbackup1001/utilities/wake.py @@ -1,35 +1,35 @@ #!/usr/bin/env python -# Wake-On-LAN -# -# Copyright (C) 2002 by Micro Systems Marc Balmer -# Written by Marc Balmer, marc@msys.ch, http://www.msys.ch/ +# Wake-On-LAN +# +# Copyright (C) 2002 by Micro Systems Marc Balmer +# Written by Marc Balmer, marc@msys.ch, http://www.msys.ch/ # This code is free software under the GPL -import struct, socket, sys +import struct, socket, sys -def WakeOnLan(ethernet_address): +def WakeOnLan(ethernet_address): -# Construct a six-byte hardware address +# Construct a six-byte hardware address - addr_byte = ethernet_address.split(':') - hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16), - int(addr_byte[1], 16), - int(addr_byte[2], 16), - int(addr_byte[3], 16), - int(addr_byte[4], 16), - int(addr_byte[5], 16)) + addr_byte = ethernet_address.split(':') + hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16), + int(addr_byte[1], 16), + int(addr_byte[2], 16), + int(addr_byte[3], 16), + int(addr_byte[4], 16), + int(addr_byte[5], 16)) -# Build the Wake-On-LAN "Magic Packet"... +# Build the Wake-On-LAN "Magic Packet"... - msg = '\xff' * 6 + hw_addr * 16 + msg = '\xff' * 6 + hw_addr * 16 -# ...and send it to the broadcast address using UDP +# ...and send it to the broadcast address using UDP - s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - s.sendto(msg, ('', 9)) - s.close() + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) + s.sendto(msg, ('', 9)) + s.close() diff --git a/usr/share/doc/lbackup/copyright b/usr/share/doc/lbackup/copyright index c96e09a..c919d0c 100644 --- a/usr/share/doc/lbackup/copyright +++ b/usr/share/doc/lbackup/copyright @@ -1,13 +1,13 @@ -Further information regarding LBackup are avilible from : +Further information regarding LBackup are avilible from : http://www.lbackup.org Copyright : LBackup is held by Lucid Information Systems and the respective -authors and contributors to the LBackup project. +authors and contributors to the LBackup project. Licence : LBackup is released under the GNU GPL v3 - + GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/usr/share/man/man1/lbackup.1 b/usr/share/man/man1/lbackup.1 index 400b9bf..3f24b66 100644 --- a/usr/share/man/man1/lbackup.1 +++ b/usr/share/man/man1/lbackup.1 @@ -10,15 +10,15 @@ lbackup - backup utility .B LBACKUP is a backup utility designed to generate browsable, -hard linked, snapshot based backup sets from a +hard linked, snapshot based backup sets from a specific directory. For details on configuration, -please refer to the LBackup website : +please refer to the LBackup website : http://www.lbackup.org .SH BUGS (1) This man page is very basic. Please visit : -http://www.lbackup.org for the latest list +http://www.lbackup.org for the latest list of bugs and also more detailed documentation. .SH AUTHOR @@ -28,7 +28,7 @@ LBackup is protected by various licenses agreements. Check http://lucidsystems.org for further details. -.SH CONTRIBUTIONS +.SH CONTRIBUTIONS Various please visit the LBackup website for details. .SH "SEE ALSO"