Skip to main content
2 of 3
Fixed typos
user avatar
user avatar

There is no flock or similar command for Solaris. If I want to do simple locking I use mkdir as it's a atomic operation and avoids potential race conditions with the usual check file exists/touch combination.

mkdir /tmp/lockfile &>/dev/null
if [[ $? -ne "0" ]]
then
    echo "Lock exists exiting"
    exit 1
fi
user591