Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    7

    Unanswered: 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

  2. #2
    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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •