diff --git a/CHANGELOG.md b/CHANGELOG.md index b87a502..b7ada1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ KNOWN ISSUES RECENT CHANGES -------------- +- Gzipped logs are now deleted once sent - Fixed some typos (thanks to Pavel Kiryukhin) - Added a simple RHEL / CentOS compatible init script - Fixed a bug with double trailing slashes in certain sceanrios diff --git a/osync.sh b/osync.sh index ca65200..b51d682 100755 --- a/osync.sh +++ b/osync.sh @@ -4,7 +4,7 @@ PROGRAM="Osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" PROGRAM_VERSION=0.99preRC3 -PROGRAM_BUILD=0903201401 +PROGRAM_BUILD=2303201401 DEBUG=no SCRIPT_PID=$$ @@ -192,10 +192,10 @@ function SendAlert Log "Current task is a quicksync task. Will not send any alert." return 0 fi - cat "$LOG_FILE" | gzip -9 > /tmp/osync_lastlog.gz + cat "$LOG_FILE" | gzip -9 > $RUN_DIR/osync_lastlog.gz if type -p mutt > /dev/null 2>&1 then - echo $MAIL_ALERT_MSG | $(type -p mutt) -x -s "Sync alert for $SYNC_ID" $DESTINATION_MAILS -a /tmp/osync_lastlog.gz + echo $MAIL_ALERT_MSG | $(type -p mutt) -x -s "Sync alert for $SYNC_ID" $DESTINATION_MAILS -a $RUN_DIR/osync_lastlog.gz if [ $? != 0 ] then Log "WARNING: Cannot send alert email via $(type -p mutt) !!!" @@ -204,7 +204,7 @@ function SendAlert fi elif type -p mail > /dev/null 2>&1 then - echo $MAIL_ALERT_MSG | $(type -p mail) -a /tmp/osync_lastlog.gz -s "Sync alert for $SYNC_ID" $DESTINATION_MAILS + echo $MAIL_ALERT_MSG | $(type -p mail) -a $RUN_DIR/osync_lastlog.gz -s "Sync alert for $SYNC_ID" $DESTINATION_MAILS if [ $? != 0 ] then Log "WARNING: Cannot send alert email via $(type -p mail) with attachments !!!" @@ -231,6 +231,11 @@ function SendAlert Log "WARNING: Cannot send alert email (no mutt / mail present) !!!" return 1 fi + + if -f $RUN_DIR/osync_lastlog.gz + then + rm $RUN_DIR/osync_lastlog.gz + fi } function LoadConfigFile