Help me fixing event handling in csh on AIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help me fixing event handling in csh on AIX
# 1  
Old 03-03-2012
Question 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
# 2  
Old 03-03-2012
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
# 3  
Old 03-04-2012
Hi Ahamed,

Thanks for your reply.

Following is the section from my script (csh)

Code:
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...

Last edited by Scott; 03-04-2012 at 11:14 AM.. Reason: Code tags, please
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. AIX

Cannot send syslog event from AIX 6.1 to RHEL Syslog server

Hi everyone, I am trying to configure AIX 6.1 using syslogd to send syslog event to syslog server configured on RHEL. However, RHEL never receives the events. I have tried to redirect the syslog event on AIX to a local file and successful. Only forwarding to remote server fails. Firewall... (10 Replies)
Discussion started by: michael_hoang
10 Replies

2. Shell Programming and Scripting

String operation in csh AIX 4.3.2.0

Hi to everybody i stuck on a simple thing i had a string and i want cut it , i try already few thing with the cut command but does not the way it should. The script is in csh and running on AIX 4.3.2.0 here are few samples how the string can look like FT71;1;1;1;;;1;31.01.2017... (9 Replies)
Discussion started by: Nadielosabra
9 Replies

3. UNIX for Advanced & Expert Users

System event on AIX

Hi, on AIX 6, are the system events historicized ? I want to know how was the performance on 18th of march. Is there any way ? thanks and regards. (2 Replies)
Discussion started by: big123456
2 Replies

4. Shell Programming and Scripting

AIX : Need help with <join> command in csh

Hi All, I need your hand to resolve an issue I am facing with a join command in one of the script. Please see the 3 files attached where file1 and file2 are the two files I am passing to the join command written in the command file. Prior to calling the join I am also sorting both the files on... (6 Replies)
Discussion started by: sraj142
6 Replies

5. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

6. AIX

Handling User Id Change in AIX

Hi, I have a query that suppose the first or last name of the user changes and we need to change its userid for aix too. Then in that case how do we handle this scenario??I guess we can't change the user id so we should re-create the new id and associate all the data of the old id. But I donno... (1 Reply)
Discussion started by: tintin@10
1 Replies
Login or Register to Ask a Question