If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Problem with ONINTR in csh script run from sh

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-21-05, 05:50
borsotti borsotti is offline
Registered User
 
Join Date: Jan 2005
Posts: 7
Problem with ONINTR in csh script run from sh

Hi all,

I'm experiencing this problem usign "onintr" command: if you run a csh script from a sh prompt, the onintr command has no effect.

Here is the csh script (working fine if run from a csh prompt):

#!/bin/csh
set exitreq = 0
onintr exit_request

while ( 1 == 1 )
if ( $exitreq == 1 ) then
printf "\n\nExit request (via signal 2), exiting..."
exit 2
endif

end

exit_request:

printf "\n\nWARNING: **** signal INTERRUPT (2) received ****...\n"
set exitreq = 1
continue


And here is the problem:

ibdvsmt1{ubmcopyprod} sh
$ mytest.csh &
8650
$ kill -2 8650
$ ps -ef | grep mytest.csh | grep -v grep
eodprod 8650 8475 2 11:16:51 pts/115 0:11 /bin/csh ./mytest.csh
$

Truss output says the signal is received but ignored:

sigprocmask(0, 0x00000000, 0xFFBED3D8) = 0
Received signal #2, SIGINT [ignored]
siginfo: SIGINT pid=5919 uid=5129
sigprocmask(SIG_BLOCK, 0xFFBED3D8, 0xFFBED3C8) = 0

Did anyone have to fight with this ?

Thanks in advance.
Ciao,
Marco
Reply With Quote
  #2 (permalink)  
Old 01-25-05, 09:44
borsotti borsotti is offline
Registered User
 
Join Date: Jan 2005
Posts: 7
ONINTR not working on Solaris but ok on AIX !!!

Try on Solaris:

ible-mx2% sh -c "mytest.csh" &
[2] 21658
ible-mx2% ps -ef | grep mytest
mxtest 21659 21658 2 15:41:04 pts/21 0:02 /bin/csh -f ./mytest.csh
mxtest 21678 20844 0 15:41:08 pts/21 0:00 grep mytest
mxtest 21658 20844 0 15:41:04 pts/21 0:00 sh -c mytest.csh
ible-mx2% kill -2 21658
ible-mx2% <no effect>


Try on AIX:


sumuser@usi_tes /home/sumuser # sh -c "mytest.csh" &
[1] 256306
sumuser@usi_tes /home/sumuser # kill -2 256306
sumuser@usi_tes /home/sumuser #

=== UBM === Tue Jan 25 15:42:52 NFT 2005 >>> WARNING: **** signal INTERRUPT (2) received ****, will exit asap...


Exit request (via signal 2), exiting...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On