updated top variables
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
lockfile="/tmp/duplicacy.lock"
|
lockfile="/tmp/restic.lock"
|
||||||
LOGFILE="/var/log/duplicacy/duplicacy_$(date +%Y%m%d-%H%M%S).log"
|
LOGFILE="/var/log/restic/restic_$(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_RESTIC_VERSION="2.7.2"
|
||||||
LATEST_DUPLICACY_VERSION="2.7.2"
|
|
||||||
|
|
||||||
# make log directory
|
# make log directory
|
||||||
if [ ! -d $(dirname ${LOGFILE}) ]; then
|
if [ ! -d $(dirname ${LOGFILE}) ]; then
|
||||||
@@ -11,7 +10,7 @@ if [ ! -d $(dirname ${LOGFILE}) ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e ${lockfile} ] && kill -0 `cat ${lockfile}`; then
|
if [ -e ${lockfile} ] && kill -0 `cat ${lockfile}`; then
|
||||||
echo "duplicacy backup already running" >> ${LOGFILE}
|
echo "Restic backup already running" >> ${LOGFILE}
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -24,17 +23,19 @@ cd $(dirname "$0")
|
|||||||
git pull > /dev/null
|
git pull > /dev/null
|
||||||
|
|
||||||
# Duplicacy version update
|
# Duplicacy version update
|
||||||
INSTALLED_DUPLICACY_VERSION=$(duplicacy -h | awk '/VERSION:/{getline; print $1}')
|
INSTALLED_RESTIC_VERSION=$(restic -h | awk '/VERSION:/{getline; print $1}')
|
||||||
if [ ${LATEST_DUPLICACY_VERSION} != ${INSTALLED_DUPLICACY_VERSION} ] || [ ! -e '/usr/bin/duplicacy' ]; then
|
if [ ${LATEST_RESTIC_VERSION} != ${INSTALLED_DUPLICACY_VERSION} ] || [ ! -e '/usr/bin/duplicacy' ]; then
|
||||||
# Determine the Kernel and Architecture
|
# Determine the Kernel and Architecture
|
||||||
KERNEL=$(uname)
|
KERNEL=$(uname)
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
if [ ${KERNEL} == 'Linux' ]; then
|
if [ ${KERNEL} == 'Linux' ]; then
|
||||||
if [ ${ARCH} == 'x86_64' ]; 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}
|
chmod +x /usr/bin/duplicacy >> ${LOGFILE}
|
||||||
elif [ ${ARCH} == 'aarch64' ]; then
|
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}
|
chmod +x /usr/bin/duplicacy >> ${LOGFILE}
|
||||||
else
|
else
|
||||||
echo "Kernel Type: ${KERNEL}"
|
echo "Kernel Type: ${KERNEL}"
|
||||||
@@ -44,7 +45,7 @@ if [ ${LATEST_DUPLICACY_VERSION} != ${INSTALLED_DUPLICACY_VERSION} ] || [ ! -e '
|
|||||||
fi
|
fi
|
||||||
elif [ ${KERNEL} == 'FreeBSD' ]; then
|
elif [ ${KERNEL} == 'FreeBSD' ]; then
|
||||||
if [ ${ARCH} == 'amd64' ]; 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}
|
chmod +x /usr/bin/duplicacy >> ${LOGFILE}
|
||||||
else
|
else
|
||||||
echo "Kernel Type: ${KERNEL}"
|
echo "Kernel Type: ${KERNEL}"
|
||||||
Reference in New Issue
Block a user