What\'s a quick-and-dirty way to make sure that only one instance of a shell script is running at a given time?
Really quick and really dirty? This one-liner on the top of your script will work:
[[ $(pgrep -c "`basename \"$0\"`") -gt 1 ]] && exit
Of course, just make sure that your script name is unique. :)