masonr / PLEXiDRIVE

Scripts to facilitate the use of cloud storage (such as Google Drive) as storage for Plex media server
MIT License
145 stars 19 forks source link

plexidrive.sh shouldn't run if the script is already being executed #1

Closed olipayne closed 7 years ago

olipayne commented 7 years ago

If plexidrive.sh checks to see if it's already running before executing, it would mean we can have a relatively frequent cronjob schedule.

masonr commented 7 years ago

Agreed. I'll add that in shortly and update this issue when done.

masonr commented 7 years ago

Fixed with commit 23fdebb. Added check at beginning of plexidrive.sh to ensure script is not already running.

masonr commented 7 years ago

Scratch that last commit. Reopening this issue and reverting the last commit as it prevents the script from being ran at all. Needs further investigation.

olipayne commented 7 years ago

Yeah I see that too, however I'm not sure why it doesnt work with an if [ "$precheck" -gt 2 ] ; then Since the script is already running at the time of the check, the count should be exactly 2.

masonr commented 7 years ago

Yeah, the issue with that is I typically run the script with screen. So it'll count the screen instance and the actual script running so the count will already be at 2 when running the script once. I'll look into finding another way to detect that the script is already running.

olipayne commented 7 years ago

PR incoming, give me a few mins

masonr commented 7 years ago

Thanks for sorting this one out.