mirror of
https://github.com/deajan/obackup.git
synced 2025-02-06 03:13:49 +01:00
Minor enhancements
This commit is contained in:
parent
385c45c46f
commit
c317e37601
@ -21,6 +21,7 @@ KNOWN ISSUES
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
- More correct error message on remote connection failure
|
||||||
- Gzipped logs are now deleted once sent
|
- Gzipped logs are now deleted once sent
|
||||||
- Fixed some typos (thanks to Pavel Kiryukhin)
|
- Fixed some typos (thanks to Pavel Kiryukhin)
|
||||||
- Improved OS detection and added prelimnary MacOS X support
|
- Improved OS detection and added prelimnary MacOS X support
|
||||||
|
20
obackup.sh
20
obackup.sh
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
###### Remote (or local) backup script for files & databases
|
###### Remote (or local) backup script for files & databases
|
||||||
###### (L) 2013 by Orsiris "Ozy" de Jong (www.netpower.fr)
|
###### (L) 2013 by Orsiris "Ozy" de Jong (www.netpower.fr)
|
||||||
OBACKUP_VERSION=1.84RC3
|
OBACKUP_VERSION=1.84preRC4
|
||||||
OBACKUP_BUILD=2303201401
|
OBACKUP_BUILD=2303201402
|
||||||
|
|
||||||
DEBUG=no
|
DEBUG=no
|
||||||
SCRIPT_PID=$$
|
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_local_$SCRIPT_PID Output of command to be run localy
|
||||||
# $RUN_DIR/obackup_run_remote_$SCRIPT_PID Output of command to be run remotely
|
# $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
|
function Log
|
||||||
{
|
{
|
||||||
echo -e "TIME: $SECONDS - $1" >> "$LOG_FILE"
|
echo -e "TIME: $SECONDS - $1" >> "$LOG_FILE"
|
||||||
@ -190,10 +192,10 @@ function CleanUp
|
|||||||
|
|
||||||
function SendAlert
|
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
|
if type -p mutt > /dev/null 2>&1
|
||||||
then
|
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 ]
|
if [ $? != 0 ]
|
||||||
then
|
then
|
||||||
Log "WARNING: Cannot send alert email via $(type -p mutt) !!!"
|
Log "WARNING: Cannot send alert email via $(type -p mutt) !!!"
|
||||||
@ -202,7 +204,7 @@ function SendAlert
|
|||||||
fi
|
fi
|
||||||
elif type -p mail > /dev/null 2>&1
|
elif type -p mail > /dev/null 2>&1
|
||||||
then
|
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 ]
|
if [ $? != 0 ]
|
||||||
then
|
then
|
||||||
Log "WARNING: Cannot send alert email via $(type -p mail) with attachments !!!"
|
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) !!!"
|
Log "WARNING: Cannot send alert email (no mutt / mail present) !!!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if -f $RUN_DIR/obackup_lastlog.gz
|
if [ -f "$GZ_LOG_PATH" ]
|
||||||
then
|
then
|
||||||
rm $RUN_DIR/obackup_lastlog.gz
|
rm "$GZ_LOG_PATH"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,6 +364,10 @@ function GetOperatingSystem
|
|||||||
"Darwin"*)
|
"Darwin"*)
|
||||||
REMOTE_OS="MacOSX"
|
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."
|
LogError "Running on remote >> $REMOTE_OS_VAR << not supported. Please report to the author."
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user