diff --git a/duplicacy.sh b/restic.sh similarity index 71% rename from duplicacy.sh rename to restic.sh index 7bc487f..c25c3f0 100644 --- a/duplicacy.sh +++ b/restic.sh @@ -1,9 +1,8 @@ #!/bin/sh -lockfile="/tmp/duplicacy.lock" -LOGFILE="/var/log/duplicacy/duplicacy_$(date +%Y%m%d-%H%M%S).log" -LATEST_DUPLICACY_VERSION="ls -lha $(dirname "$0")/binaries/ | awk '/-rw/{print substr($9,length($9)-4);exit}'" -LATEST_DUPLICACY_VERSION="2.7.2" +lockfile="/tmp/restic.lock" +LOGFILE="/var/log/restic/restic_$(date +%Y%m%d-%H%M%S).log" +LATEST_RESTIC_VERSION="2.7.2" # make log directory if [ ! -d $(dirname ${LOGFILE}) ]; then @@ -11,7 +10,7 @@ if [ ! -d $(dirname ${LOGFILE}) ]; then fi if [ -e ${lockfile} ] && kill -0 `cat ${lockfile}`; then - echo "duplicacy backup already running" >> ${LOGFILE} + echo "Restic backup already running" >> ${LOGFILE} exit fi @@ -24,17 +23,19 @@ cd $(dirname "$0") git pull > /dev/null # Duplicacy version update -INSTALLED_DUPLICACY_VERSION=$(duplicacy -h | awk '/VERSION:/{getline; print $1}') -if [ ${LATEST_DUPLICACY_VERSION} != ${INSTALLED_DUPLICACY_VERSION} ] || [ ! -e '/usr/bin/duplicacy' ]; then +INSTALLED_RESTIC_VERSION=$(restic -h | awk '/VERSION:/{getline; print $1}') +if [ ${LATEST_RESTIC_VERSION} != ${INSTALLED_DUPLICACY_VERSION} ] || [ ! -e '/usr/bin/duplicacy' ]; then # Determine the Kernel and Architecture KERNEL=$(uname) ARCH=$(uname -m) if [ ${KERNEL} == 'Linux' ]; then if [ ${ARCH} == 'x86_64' ]; then - curl -vL -o /usr/bin/duplicacy https://github.com/gilbertchen/duplicacy/releases/download/v${LATEST_DUPLICACY_VERSION}/duplicacy_linux_x64_${LATEST_DUPLICACY_VERSION} >> ${LOGFILE} 2>&1 + curl -vL -o /usr/bin/duplicacy https://github.com/gilbertchen/duplicacy/releases/download/v${LATEST_RESTIC_VERSION}/duplicacy_linux_x64_${LATEST_RESTIC_VERSION} >> ${LOGFILE} 2>&1 + #https://github.com/restic/restic/releases/download/v0.12.1/restic_0.12.1_freebsd_amd64.bz2 + #curl -vL -o /usr/bin/duplicacy https://github.com/gilbertchen/duplicacy/releases/download/v${LATEST_RESTIC_VERSION}/duplicacy_linux_x64_${LATEST_RESTIC_VERSION} >> ${LOGFILE} 2>&1 chmod +x /usr/bin/duplicacy >> ${LOGFILE} elif [ ${ARCH} == 'aarch64' ]; then - curl -vL -o /usr/bin/duplicacy https://github.com/gilbertchen/duplicacy/releases/download/v${LATEST_DUPLICACY_VERSION}/duplicacy_linux_arm64_${LATEST_DUPLICACY_VERSION} >> ${LOGFILE} 2>&1 + curl -vL -o /usr/bin/duplicacy https://github.com/gilbertchen/duplicacy/releases/download/v${LATEST_RESTIC_VERSION}/duplicacy_linux_arm64_${LATEST_RESTIC_VERSION} >> ${LOGFILE} 2>&1 chmod +x /usr/bin/duplicacy >> ${LOGFILE} else echo "Kernel Type: ${KERNEL}" @@ -44,7 +45,7 @@ if [ ${LATEST_DUPLICACY_VERSION} != ${INSTALLED_DUPLICACY_VERSION} ] || [ ! -e ' fi elif [ ${KERNEL} == 'FreeBSD' ]; then if [ ${ARCH} == 'amd64' ]; then - curl -vL -o /usr/bin/duplicacy https://github.com/gilbertchen/duplicacy/releases/download/v${LATEST_DUPLICACY_VERSION}/duplicacy_freebsd_x64_${LATEST_DUPLICACY_VERSION} >> ${LOGFILE} 2>&1 + curl -vL -o /usr/bin/duplicacy https://github.com/gilbertchen/duplicacy/releases/download/v${LATEST_RESTIC_VERSION}/duplicacy_freebsd_x64_${LATEST_RESTIC_VERSION} >> ${LOGFILE} 2>&1 chmod +x /usr/bin/duplicacy >> ${LOGFILE} else echo "Kernel Type: ${KERNEL}"