Or just have your script make a lock file somewhere on a persistent file system and exit if it exists.
totally foolproof except for the race condition between when your script crashes and you hit up-arrow then enter, someone else with your user account might change it maliciously.