Adding lock to nc-sync to ensure only one runs at a time
This commit is contained in:
parent
6444dc65c1
commit
c1c49aa7d3
|
@ -1,6 +1,22 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
NC_DIR="$HOME/Nextcloud"
|
(
|
||||||
NC_URL="https://cloud.criminallycute.fi"
|
if flock -n 9
|
||||||
|
then
|
||||||
|
notify-send 'Not doing the critical operation (lock present).'
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Needed for cronjob
|
||||||
|
source /home/siina/.config/private.env
|
||||||
|
|
||||||
|
NC_DIR="/home/siina/Nextcloud"
|
||||||
|
NC_URL="https://cloud.criminallycute.fi"
|
||||||
|
|
||||||
|
notify-send "Nextcloud Sync Syncing ..."
|
||||||
|
nextcloudcmd -u $NC_USER -p $NC_PASS $NC_DIR $NC_URL
|
||||||
|
notify-send "Nextcloud Sync Done syncing"
|
||||||
|
|
||||||
|
) 9>'/tmp/nc-sync.lock'
|
||||||
|
rm -f '/tmp/nc-sync.lock'
|
||||||
|
|
||||||
nextcloudcmd -s -u $NC_USER -p $NC_PASS $NC_DIR $NC_URL
|
|
||||||
|
|
Loading…
Reference in New Issue