exit if lockfile present
This commit is contained in:
parent
1e3638d474
commit
359d346c33
10
btrbk-cron
10
btrbk-cron
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CONF=/etc/btrbk/btrbk-cron.conf
|
CONF=/etc/btrbk/btrbk-cron.conf
|
||||||
|
LOCKFILE=/run/btrbk/btrbk.lock
|
||||||
LOGFILE=$(mktemp)
|
LOGFILE=$(mktemp)
|
||||||
trap 'rm -f -- "${LOGFILE}"' EXIT
|
trap 'rm -f -- "${LOGFILE}"' EXIT
|
||||||
|
|
||||||
@ -29,6 +30,15 @@ else
|
|||||||
echo "Info: Healthchecks disabled"
|
echo "Info: Healthchecks disabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -f "${LOCKFILE}" ]] ; then
|
||||||
|
echo "Another instance is still running" | tee -a "${LOGFILE}"
|
||||||
|
if [[ "${HEALTHCHECK_ENABLE}" = "true" ]] ; then
|
||||||
|
curl "${CURLOPTS[@]}" --data-binary "@${LOGFILE}" "${HEALTHCHECK_URL}/log"
|
||||||
|
fi
|
||||||
|
rm -f -- "${LOGFILE}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
HOST=$(grep -E '^[\ \t]*target[\ \t]+send-receive' /etc/btrbk/btrbk.conf)
|
HOST=$(grep -E '^[\ \t]*target[\ \t]+send-receive' /etc/btrbk/btrbk.conf)
|
||||||
# TODO: support for dashes in hostname and IPv6 ("[2001:db8::7]")
|
# TODO: support for dashes in hostname and IPv6 ("[2001:db8::7]")
|
||||||
HOST=$(echo "${HOST}" | sed -r 's/.*ssh:\/\/([0-9\.a-zA-Z]+).*/\1/g' )
|
HOST=$(echo "${HOST}" | sed -r 's/.*ssh:\/\/([0-9\.a-zA-Z]+).*/\1/g' )
|
||||||
|
Loading…
Reference in New Issue
Block a user