summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-06-02 20:53:46 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-06-02 20:53:46 +0800
commite77257e756527f6fe7209ecdf27239d5dd5f6d36 (patch)
tree9e889688ed008ece4f9c53978d9364f8e41a71f0
parente3cda15e3cf8ec158b468332c9b13e9de4ebb663 (diff)
fixed sleep 10 prerequirement, fixed cleanup()
-rwxr-xr-xidle.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/idle.sh b/idle.sh
index 50ac312..a83376d 100755
--- a/idle.sh
+++ b/idle.sh
@@ -25,10 +25,9 @@ fi
function cleanup() {
/sbin/echo "Cleaning up..."
- sudo /sbin/rm -f $lockpath/$lockfile || /sbin/echo "Failed removing lock file at $lockpath/$lockfile"
- sudo /sbin/rm -f $lockpath/$pidfile || /sbin/echo "Failed removing PID file at $lockpath/$pidfile"
- sudo /sbin/rm -f $lockpath/$disablelockfile || /sbin/echo "Failed removing disable lock file at $lockpath/$disablelockfile"
+ sudo /sbin/rm -rf $lockpath || /sbin/echo "Failed removing locks at $lockpath"
/sbin/echo "Exiting..."
+ exit 0
}
trap cleanup SIGINT SIGTERM
@@ -111,8 +110,9 @@ if [ "$1" ]; then
if [[ "$(xprintidle)" -gt $IDLETIME && ! -f $lockpath/$lockfile && $1 ]]; then # Changed from 600000 (10 minutes) to 3600000 (1 hour)
idle
continue
- else
+ elif [[ ! -f $lockpath/$lockfile && $1 ]]; then
sleep 10
+ continue
fi
if [[ "$(xprintidle)" -le $IDLEBACKTIME && -f $lockpath/$lockfile ]]; then
stopidle