Skip to content

Commit 3622274

Browse files
authored
Add files via upload
1 parent b65d825 commit 3622274

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

nodeapp_debounce.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
LOCKFILE="/tmp/nodeapp_debounce.lock"
3+
TIMEOUT=5
4+
5+
# Check if lockfile exists
6+
if [ -e "$LOCKFILE" ]; then
7+
touch "$LOCKFILE" # Update lockfile timestamp
8+
exit 1
9+
fi
10+
11+
# Create lockfile
12+
touch "$LOCKFILE"
13+
14+
# Ensure lockfile is removed on script exit
15+
trap 'rm -f "$LOCKFILE"' EXIT
16+
17+
# Wait until the lockfile is $TIMEOUT seconds old
18+
while [ $(( $(date +%s) - $(stat -c %Y "$LOCKFILE") )) -lt $TIMEOUT ]; do
19+
sleep 1
20+
done
21+
22+
# Your script logic goes here
23+
/usr/local/hestia/bin/v-invoke-plugin nodeapp_debounce
24+
25+
# Lockfile will be removed automatically due to trap
26+
exit 0

0 commit comments

Comments
 (0)