bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Disowned process hangs terminal during logout/exit


From: Jesse Molina
Subject: Disowned process hangs terminal during logout/exit
Date: Wed, 5 Dec 2007 13:35:59 -0700
User-agent: Mutt/1.5.17 (2007-11-01)

Hi!

I am having a problem on two Linux systems and then not on two others.  
Slightly differnt OS and bash in each case.  I'm puzzled.

Basically, on the two troubled systems, my interactive shell will hang after 
I've disowned a process.  On one other system, everything works as expected.  I 
expect that a disowned process should not hang logout -- disowned means 
disowned.

I've compared shopt and env vars and don't know what is going on.  I've googled 
and didn't see an obvious solution or answer.

It seems like it's hanging on stdout since redirecting to /dev/null fixes the 
problem.

Below is a sample script;

--

#!/bin/bash -e
# Background daemon test

echo "Running sleep for 30 seconds..."
# This will allow logout and won't hang the interactive terminal to wait
# for stdout...
#(sleep 30 > /dev/null 2>&1) &
#
# However, this hangs on logout...
(sleep 30) &

LASTPID=$!
echo "Done."
echo ""
echo "Last PID was $LASTPID"
disown $LASTPID
echo ""
echo "disowned $LASTPID"
echo ""
echo "TEST: is it there?"
echo "--"
ps axuw|grep $LASTPID|grep -v grep
ps laxw|grep $LASTPID|grep -v grep
echo "--"
echo ""

exit 0

--

Here is the actual line where I am having trouble.  I can't redirect tail's 
output in this case.  It seems like tail is the offender.

(tail -f < /dev/null | $NETCAT -l -p $LISTENPORT >> $LOGFILE 2>&1) &



-- 
# Jesse Molina
# Mail = jesse@opendreams.net
# Page = page-jesse@opendreams.net
# Cell = 1.602.323.7608
# Web  = http://www.opendreams.net/jesse/
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]