I've a script that build a pid file:
if [ -f $PIDDIR$NOS.pid ]
then
echo "PID exists"
exit 1
else
echo "PID does not exist"
echo
echo "build..."
touch $PIDDIR$NOS.pid
[starting script...]
I need "a check" that remove that file if (i.e.) the script has killed or other problems like disk full. Otherwise next execute of script does not run because there's the pid file.
trapdo what you want here? Alternatively improve your check to write the script pid to the file and then read and check that the pid is still alive and the script you expect in your check condition.