Skip to main content
No need to use non-standard syntax here.
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

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.

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

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

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.

if ! mkdir /tmp/lockdir >/dev/null 2>&1
then
    echo >&2 "Lock exists exiting"
    exit 1
fi
Fixed typos
Source Link
user591
user591

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

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

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

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

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
Source Link
user591
user591

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

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