Browse Source

Create lockfiles for cronjob

main
Björn Pettersson 3 years ago
parent
commit
4c213f3de3
  1. 15
      cron-scripts/10-test.sh

15
cron-scripts/10-test.sh

@ -1,5 +1,16 @@
#!/usr/bin/env -S guix shell bash -- bash
test -e /tmp/cron-10-test.sh.lock && find /tmp/cron-10-test.sh.lock -cmin +10 -delete
if test -e /tmp/cron-10-test.sh.lock
then
echo "Lockfile exists"
exit 1
fi
echo "Creating lockfile"
touch /tmp/cron-10-test.sh.lock
set -x
host_conf=$(hostname).scm
@ -18,7 +29,9 @@ then
else
echo "guix system reconfigure /etc/config.scm failure"
cp -v "/etc/config.scm.backup" "/etc/config.scm"
exit 1
fi
fi
fi
echo "Removing lockfile"
rm -fv /tmp/cron-10-test.sh.lock

Loading…
Cancel
Save