Simple bash script: #!/bin/bashset -eexec 7<"$0"flock -n 7sleep 60
Will prevent a second instance from being executed (exits instantly). But if the first instance got killed by 'killall test.sh', the second instance of the script can be executed only after 60 seconds. First instance of the script does report being killed instantly, but still does not let me run the second instance of the script. That makes me think, sleep command not being killed / handled correctly. Here is a work around example, using the following script makes it work correctly: #!/bin/bashset -etrap "kill 0" SIGINT SIGTERMexec 7<"$0"flock -n 7sleep 60 Flock waits until sleep finishes, even when the script holding lock is killed. Is it a bug or feature? -- AK