Public bug reported:

Binary package hint: cron

I am running a shell script to create a reverse ssh tunnel to my home
machine using an entry in my user's crontab.

$ crontab -l
# m h  dom mon dow   command
*/5 * * * * /home/blink/scripts/ssh_home.sh

$ cat scripts/ssh_home.sh 
#!/bin/bash
REMOTE_HOST="myremotehost.domain.tld"
LISTEN_PORT=2222
[ -f $HOME/.keychain/$HOSTNAME-sh ] && . $HOME/.keychain/$HOSTNAME-sh
if [ "$SSH_AUTH_SOCK" -o "$SSH_AGENT_PID" ]
then
        COMMAND="ssh -i /home/blink/.ssh/id_rsa -C -N -f -R 
${LISTEN_PORT}:localhost:22 $REMOTE_HOST"
        pgrep -f -x "$COMMAND" > /dev/null 2>&1 || $COMMAND
else
        echo Cowardly exiting
        exit 1
fi
exit 0


A relevant snippet of ps auxf is as follows:
root      5983  0.0  0.0  20832   956 ?        Ss   Sep05   0:00 /usr/sbin/cron
root     12506  0.0  0.0  31436   976 ?        S    11:10   0:00  \_ 
/USR/SBIN/CRON
blink    12507  0.0  0.0      0     0 ?        Zs   11:10   0:00      \_ 
[ssh_home.sh] <defunct>
blink    12510  0.0  0.0  42216   992 ?        Ss   11:10   0:00 ssh -i 
/home/blink/.ssh/id_rsa -C -N -f -R 2222:localhost:22 myremotehost.domain.tld

As you can see, /usr/sbin/cron launches /USR/SBIN/CRON which launches my
script.  my script executes and exits cleanly when invoked from the
command line.  I asked about this behavior on irc.freenode.org in #bash
and the consensus was that this was buggy behavior on the part of cron.

Kind regards,
Chris

** Affects: cron (Ubuntu)
     Importance: Undecided
         Status: New

-- 
cron's immediate child becomes a zombie process
https://bugs.launchpad.net/bugs/137785
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to