diff --git a/plexidrive.sh b/plexidrive.sh index 350a600..b9f9b93 100644 --- a/plexidrive.sh +++ b/plexidrive.sh @@ -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"