replacing flock with simple if and touch

This commit is contained in:
Siina Mashek 2024-04-27 18:02:44 +03:00
parent fc5c034716
commit f1b9783547
3 changed files with 9 additions and 20 deletions

View file

@ -1,4 +0,0 @@
#!/bin/sh
export HOME=$HOME/games
/usr/bin/steam

View file

@ -1,4 +0,0 @@
#!/bin/sh
HOME=$HOME/.cache/vscode-oss /usr/bin/vscodium

View file

@ -1,22 +1,19 @@
#!/bin/sh
(
if flock -n 9
then
echo 'Lock present, exiting'
exit;
fi
if [ -f /tmp/nc-sync.lock ]; then
notify-send "Lock found, exiting"
exit 1
else
touch /tmp/nc-sync.lock
# Needed for cronjob
source /home/siina/.config/private.env
NC_DIR="/home/siina/Nextcloud"
NC_URL="https://cloud.criminallycute.fi"
echo "Nextcloud Sync Syncing ..."
notify-send "Nextcloud Sync Syncing ..."
nextcloudcmd -u $NC_USER -p $NC_PASS $NC_DIR $NC_URL
echo "Nextcloud Sync Done syncing"
) 9>'/tmp/nc-sync.lock'
rm -f '/tmp/nc-sync.lock'
notify-send "Nextcloud Sync Done syncing"
rm /tmp/nc-sync.lock
fi