This repository has been archived on 2021-02-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
duplicacy-scripts-OLD/duplicacy.sh
2019-12-04 18:40:32 -05:00

23 lines
551 B
Bash

#!/bin/sh
lockfile="/tmp/duplicacy.lock"
LOGFILE="/var/log/duplicacy/duplicacy_$(date +%Y%m%d-%H%M%S).log"
if [ -e ${lockfile} ] && kill -0 `cat ${lockfile}`; then
echo "duplicacy backup already running" >> ${LOGFILE}
exit
fi
# make sure the lockfile is removed when we exit and then claim it
trap "rm -f ${lockfile}; exit" INT TERM EXIT
echo $$ > ${lockfile}
# run the backup
cd /
duplicacy -verbose -log backup -stats >> ${LOGFILE} 2>&1
# compress the logs
gzip $(dirname ${LOGFILE})/*.log
# clean up lockfile
rm -f ${lockfile}