rsync_backup.sh
Initial commit
This commit is contained in:
parent
c6a2e0fada
commit
474013f24c
37
rsync_backup.sh
Normal file
37
rsync_backup.sh
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Specifications
|
||||||
|
SOURCES=("[SOURCE1] [SOURCE2]")
|
||||||
|
TARGET="[DESTINATION]"
|
||||||
|
|
||||||
|
GOTIFY_SERVER="[SERVERURL]"
|
||||||
|
GOTIFY_TOKEN="[TOKEN]"
|
||||||
|
LOGFILE="rsync.log"
|
||||||
|
|
||||||
|
rm $LOGFILE
|
||||||
|
|
||||||
|
# Perform the backup using rsync
|
||||||
|
rsync -av --exclude '@eaDir' \
|
||||||
|
--no-perms \
|
||||||
|
--no-group \
|
||||||
|
--no-owner \
|
||||||
|
--inplace \
|
||||||
|
--exclude=[#]recycle \
|
||||||
|
--log-file=$LOGFILE \
|
||||||
|
--log-file-format="File changed! %f %i" \
|
||||||
|
$SOURCES $TARGET
|
||||||
|
RESULT=$?
|
||||||
|
|
||||||
|
if [[ $RESULT -gt 0 ]]
|
||||||
|
then
|
||||||
|
SUBJECT="ERROR - Rsync Report"
|
||||||
|
PRIORITY="10"
|
||||||
|
else
|
||||||
|
SUBJECT="SUCCESS - Rsync Report"
|
||||||
|
PRIORITY="1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Send the notification
|
||||||
|
INTRO=$'The last three lines of the log are as follows:\n'
|
||||||
|
MESSAGE="$(tail -n 3 $LOGFILE)"
|
||||||
|
curl "$GOTIFY_SERVER/message?token=$GOTIFY_TOKEN" -F "title=$SUBJECT" -F "message=$INTRO $MESSAGE" -F "priority=$PRIORITY"
|
Loading…
Reference in New Issue
Block a user