Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- SLEEPTIME="30"
- PIDFILE="/tmp/plexWatchJob.pid"
- if [ -f "$PIDFILE" ]; then
- PID=$(cat $PIDFILE)
- if ps -p $PID > /dev/null; then
- echo "Job already running. Aborting."
- exit 1
- else
- echo "PID file existing, but Job not running. Starting..."
- fi
- fi
- echo "Starting job..."
- echo $BASHPID > /tmp/plexWatchJob.pid
- while [ -f "$PIDFILE" ]; do
- sleep $SLEEPTIME
- /opt/plexWatch/plexWatch.pl
- done
- echo "Job ended."
Add Comment
Please, Sign In to add comment