I am using Ubuntu 12.0.4 I have a script basically with the following codes:
lockfile=/var/tmp/mylock if ( set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then exit_normally "instance is running" else echo "no instance is running" fi
The file /var/tmp/mylock doesn't exists in my system, so when I execute my script manually I get "no instance is running" which is correct.
But when the shell script is executed by cron, it always return "instance is running"
I am not sure where to check or what to look for to find the root cause for the problem above, hopefuly I can get a few pointers here..