aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-05-09 13:06:46 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-05-09 13:06:46 -0300
commit35b09a5f86bc2ecf166a47391da203aa01c9fce3 (patch)
treecb9bfd89cdcf1b6298b48bc814c639d42fb873a5
parent8eb0eabe388b35032ec085d694df8a7d78d2a575 (diff)
downloadborger-35b09a5f86bc2ecf166a47391da203aa01c9fce3.tar.gz
borger-35b09a5f86bc2ecf166a47391da203aa01c9fce3.tar.bz2
Fix: minor changes
-rwxr-xr-xborger3
1 files changed, 3 insertions, 0 deletions
diff --git a/borger b/borger
index 53274d1..7e35c38 100755
--- a/borger
+++ b/borger
@@ -30,6 +30,7 @@ OPTION="$2"
BASE_CONFIG="$HOME/.config/borger"
CONFIG="$BASE_CONFIG/$DESTINATION"
INTERVAL="2h"
+TMP="${TMP:-/tmp}"
# Print info
function info {
@@ -198,6 +199,7 @@ function borger_prune {
function borger_set_lockfile {
if [ ! -z "$LOCKFILE" ]; then
mkdir -p `dirname $LOCKFILE`
+
if ( set -o noclobber; echo "$$" > "$LOCKFILE" ) &> /dev/null; then
trap 'borger_unset_lockfile' INT TERM EXIT
else
@@ -220,6 +222,7 @@ function borger_check_lockfile {
if [ ! -z "$LOCKFILE" ] && [ -f "$LOCKFILE" ]; then
pid="`cat $LOCKFILE`"
process="`ps --no-headers -o comm $pid`"
+
if [ "$?" == "0" ] && [ "`ps --no-headers -o comm $$`" == "$process" ]; then
fatal "Another program is running for $LOCKFILE, skipping run"
else