From f1b9783547b45d916efbb7325da98dd1a242e026 Mon Sep 17 00:00:00 2001 From: Siina Mashek Date: Sat, 27 Apr 2024 18:02:44 +0300 Subject: [PATCH] replacing flock with simple if and touch --- apsalar/global/steam | 4 ---- apsalar/global/vscodium | 4 ---- apsalar/nc-sync | 21 +++++++++------------ 3 files changed, 9 insertions(+), 20 deletions(-) delete mode 100755 apsalar/global/steam delete mode 100755 apsalar/global/vscodium diff --git a/apsalar/global/steam b/apsalar/global/steam deleted file mode 100755 index cc11411..0000000 --- a/apsalar/global/steam +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -export HOME=$HOME/games -/usr/bin/steam diff --git a/apsalar/global/vscodium b/apsalar/global/vscodium deleted file mode 100755 index 2330545..0000000 --- a/apsalar/global/vscodium +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -HOME=$HOME/.cache/vscode-oss /usr/bin/vscodium - diff --git a/apsalar/nc-sync b/apsalar/nc-sync index d9bce02..e8db4f7 100755 --- a/apsalar/nc-sync +++ b/apsalar/nc-sync @@ -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