diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-06-02 20:53:46 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-06-02 20:53:46 +0800 |
| commit | e77257e756527f6fe7209ecdf27239d5dd5f6d36 (patch) | |
| tree | 9e889688ed008ece4f9c53978d9364f8e41a71f0 | |
| parent | e3cda15e3cf8ec158b468332c9b13e9de4ebb663 (diff) | |
fixed sleep 10 prerequirement, fixed cleanup()
| -rwxr-xr-x | idle.sh | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 |
