about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-09-28 16:00:45 -0400
committerCharadon <dev@iotib.net>2022-09-28 16:00:45 -0400
commit845bbfee27d0879d5f83afb6a09f9436124e5bed (patch)
tree049af47324b3f2218c66bdf634953b0e4a5aad26
parent8bed3c1180a5840b4d4d7d2b74717550409feaf2 (diff)
parent5eec8261658d0e629750669bf02080a25c75b26c (diff)
downloaddscip-845bbfee27d0879d5f83afb6a09f9436124e5bed.tar.gz
Merge branch 'master' of www.opencode.net:charadon/dscip
-rwxr-xr-xdscip23
1 files changed, 11 insertions, 12 deletions
diff --git a/dscip b/dscip
index 99915ee..8532b9f 100755
--- a/dscip
+++ b/dscip
@@ -29,14 +29,14 @@ if [ "$DSCIP_AUTO_UPDATE" = "true" ]; then
 	DSCIP_NEW_CKSUM="$(cksum "$0")"
 	# Rerun dscip if update was found.
 	if [ ! "$DSCIP_CKSUM" = "$DSCIP_NEW_CKSUM" ]; then
-		echo "Update found. Rerunning DSCIP..."
+		echo "[dscip] Update found. Rerunning DSCIP..."
 		"$SHELL" "$0" "$@"
 		exit 0
 	else
-		echo "No updates found. Continuing..."
+		echo "[dscip] No updates found. Continuing..."
 	fi
 else
-	echo "Auto updates turned off. Continuing..."
+	echo "[dscip] Auto updates turned off. Continuing..."
 fi
 
 ################################################################################
@@ -55,19 +55,18 @@ set -u
 if [ -f "$WORKING_DIRECTORY/LOCK" ]; then
 	LOCKED_PID=$(cat "$WORKING_DIRECTORY/LOCK")
 	# shellcheck disable=SC2009
-	if ps -aux | grep -w "[^]]$LOCKED_PID" > /dev/null; then
-		echo "Script still running. Exiting..."
-		exit 0
-	else
-		echo "Script not running, resetting lock..."
-		rm "$WORKING_DIRECTORY/LOCK"
-	fi
+	for i in $(pgrep -f "$0"); do
+		if [ "$i" = "$LOCKED_PID" ]; then
+			echo "[dscip] Script still running. Exiting..."
+			exit 0
+		fi
+	done
+	echo "[dscip] Script not running. Removing old lock."
+	rm -f "$WORKING_DIRECTORY/LOCK"
 fi
 
 echo "$$" > "$WORKING_DIRECTORY/LOCK"
 
-
-
 build () {
 	# Remove old output
 	rm -f "$WORKING_DIRECTORY"/output.txt
ion_array.cc?h=hlt&id=b24eb4766ad12eceaafa2ee0d620e070e21a3293'>b24eb476 ^
8d82da3c ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40