Hi All,
My requirement is i have a script A.sh .When a person A runs the script A.sh it should get locked and person B should not run the script.
i followed the below code
f_script_lock()
{
process=$1
user=`ps -ef | grep -i "$process" | grep -i 'ksh' | awk '{print $1;}'`
if [ ! -z $user ]; then
echo "Recovery is handled by $user. Hence cannot proceed in Recovery"
exit
else
continue
fi
}
The above is working fine in normal conditions.
But when person A runs the query and press Ctrl+C intermitently the code stops running.
When person B or even person A tries to execute the A.sh again after sometime it says it has been accessed by the user and not able to execute.
Please help me on this.