1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-12 19:03:42 +01:00

Minor enhancements

This commit is contained in:
deajan 2014-03-23 21:59:13 +01:00
parent 385c45c46f
commit c317e37601
2 changed files with 14 additions and 7 deletions

View File

@ -21,6 +21,7 @@ KNOWN ISSUES
CHANGELOG
---------
- More correct error message on remote connection failure
- Gzipped logs are now deleted once sent
- Fixed some typos (thanks to Pavel Kiryukhin)
- Improved OS detection and added prelimnary MacOS X support

View File

@ -2,8 +2,8 @@
###### Remote (or local) backup script for files & databases
###### (L) 2013 by Orsiris "Ozy" de Jong (www.netpower.fr)
OBACKUP_VERSION=1.84RC3
OBACKUP_BUILD=2303201401
OBACKUP_VERSION=1.84preRC4
OBACKUP_BUILD=2303201402
DEBUG=no
SCRIPT_PID=$$
@ -56,6 +56,8 @@ TOTAL_FILES_SIZE=0 # Total file size of $DIRECTORIES_TO_BACKUP
# $RUN_DIR/obackup_run_local_$SCRIPT_PID Output of command to be run localy
# $RUN_DIR/obackup_run_remote_$SCRIPT_PID Output of command to be run remotely
GZ_LOG_PATH=$RUN_DIR/obackup_lastlog.gz # This is the path where to store a temporary log file to send by mail
function Log
{
echo -e "TIME: $SECONDS - $1" >> "$LOG_FILE"
@ -190,10 +192,10 @@ function CleanUp
function SendAlert
{
cat "$LOG_FILE" | gzip -9 > $RUN_DIR/obackup_lastlog.gz
cat "$LOG_FILE" | gzip -9 > "$GZ_LOG_PATH"
if type -p mutt > /dev/null 2>&1
then
echo $MAIL_ALERT_MSG | $(type -p mutt) -x -s "Backup alert for $BACKUP_ID" $DESTINATION_MAILS -a $RUN_DIR/obackup_lastlog.gz
echo $MAIL_ALERT_MSG | $(type -p mutt) -x -s "Backup alert for $BACKUP_ID" $DESTINATION_MAILS -a "$GZ_LOG_PATH"
if [ $? != 0 ]
then
Log "WARNING: Cannot send alert email via $(type -p mutt) !!!"
@ -202,7 +204,7 @@ function SendAlert
fi
elif type -p mail > /dev/null 2>&1
then
echo $MAIL_ALERT_MSG | $(type -p mail) -a $RUN_DIR/obackup_lastlog.gz -s "Backup alert for $BACKUP_ID" $DESTINATION_MAILS
echo $MAIL_ALERT_MSG | $(type -p mail) -a "$GZ_LOG_PATH" -s "Backup alert for $BACKUP_ID" $DESTINATION_MAILS
if [ $? != 0 ]
then
Log "WARNING: Cannot send alert email via $(type -p mail) with attachments !!!"
@ -229,9 +231,9 @@ function SendAlert
Log "WARNING: Cannot send alert email (no mutt / mail present) !!!"
fi
if -f $RUN_DIR/obackup_lastlog.gz
if [ -f "$GZ_LOG_PATH" ]
then
rm $RUN_DIR/obackup_lastlog.gz
rm "$GZ_LOG_PATH"
fi
}
@ -362,6 +364,10 @@ function GetOperatingSystem
"Darwin"*)
REMOTE_OS="MacOSX"
;;
"ssh"*)
LogError "Cannot connect to remote system."
exit 1
;;
*)
LogError "Running on remote >> $REMOTE_OS_VAR << not supported. Please report to the author."
exit 1