Help me fixing event handling in csh on AIX

Hi All,

I have problem with a csh script. This script simply search for a certail process id and kill that using simple kill -5 <pid>. Everything is okay untill there is valid process id trapped. But if the process id is already cleaned before the execution of the kill command, but script ends saying the pid not found.
Is there any mechanism, I can apply to force the script not to exit from the shell and keep in loop for the next one even the process id is not found ?

Regards
sraj142

It can be done, but requires more details. If the PID is not found, you said "loop for the next one" which next one? Are you giving it a list of PID's to be killed or continue checking for the same PID?

Please paste your code sample.

Why not use bash or ksh?
CSH Programming considered harmful

--ahamed

Hi Ahamed,

Thanks for your reply.

Following is the section from my script (csh)

if ($chk < $fmin || $chk > $fmax) then
          echo "OUT OF RANGE. Current $chk%. Normal from $fmin% to $fmax%" >> $MLOG
         if ("$bchk" == "0") then      # If backup is not running, force a sync
            # Following line is added by sraj as often the BEGBLOCK process found uncleaned normally
            set procid=`lgdump -b | head -3 | tail -1 | nawk -F. '{print $(NF-1)}' | sed '1,$s/ //g'`
             if ("$procid" !="") then
               kill -5 $procid
             endif
            sleep 5
            fmdmn -F 'file.db'
            sleep 3
            fmdmn -F 'file.db'
            echo " -> Action taken was: force database synch. " >> $MLOG
         endif
      endif

Okay, those "lgdump", "fmdmn" commands are the database utilities. So don't be confused. Even if the process is cleaned from OS part still its been shown alive by "lgdump" utility which I want to trap here. But the script exits when the "kill -5" do not find any such process. I just want to restrict my script from quiting in this case.

Please see if can be of some help.

Regards...