Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2 from olipayne/master
Browse files Browse the repository at this point in the history
ensure only one instance of plexidrive.sh is running at a time
  • Loading branch information
masonr committed May 4, 2017
2 parents 5e8c6a3 + 3096abc commit e28d638
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plexidrive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
## server. ##
######################################################

# Make sure that this the ONLY instance of this script running
for pid in $(pidof -x plexidrive.sh); do
if [ $pid != $$ ]; then
echo "This script is already running, exiting to avoid duplicate uploads."
exit 1
fi
done

# Directory where this file exists
plexidrive_dir=`dirname $(realpath -s $0)`
cd "$plexidrive_dir"
Expand Down

0 comments on commit e28d638

Please sign in to comment.