FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 10-24-2008, 03:48 PM
"Sean Carolan"
 
Default Certain scripts "hang" the terminal on logout

I have an init script that after running, causes my terminal not to
log out cleanly. Here's what i mean:

# /etc/init.d/script restart << this runs fine, returns my shell prompt
# exit << When I enter this command, my shell window just stays
"stuck" and actually won't close down.

Anyone know why this happens?
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-24-2008, 03:51 PM
Matt Hyclak
 
Default Certain scripts "hang" the terminal on logout

On Fri, Oct 24, 2008 at 10:48:53AM -0500, Sean Carolan enlightened us:
> I have an init script that after running, causes my terminal not to
> log out cleanly. Here's what i mean:
>
> # /etc/init.d/script restart << this runs fine, returns my shell prompt
> # exit << When I enter this command, my shell window just stays
> "stuck" and actually won't close down.
>
> Anyone know why this happens?

Are you spawning/backgrounding jobs in the script?

Matt

--
Matt Hyclak
Systems and Operations
Office of Information Technology
Ohio University
(740) 593-1222
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-24-2008, 03:55 PM
"Filipe Brandenburger"
 
Default Certain scripts "hang" the terminal on logout

Hi,

On Fri, Oct 24, 2008 at 11:48, Sean Carolan <scarolan@gmail.com> wrote:
> # /etc/init.d/script restart << this runs fine, returns my shell prompt
> # exit << When I enter this command, my shell window just stays
> "stuck" and actually won't close down.
>
> Anyone know why this happens?

Yes, it's because the daemon started from that script keeps file
descriptors opened to the terminal you are connected to. This might be
considered a bug in the daemon, since a proper daemon should close all
its file descriptors before going background and returning to the
shell.

You might try to change the script in init.d to append "</dev/null
>/dev/null 2>&1" at the line that starts the daemon, this might force
it to detach itself from the terminal.

HTH,
Filipe
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-24-2008, 03:55 PM
"Sean Carolan"
 
Default Certain scripts "hang" the terminal on logout

>> # /etc/init.d/script restart << this runs fine, returns my shell prompt
>> # exit << When I enter this command, my shell window just stays
>> "stuck" and actually won't close down.
>>
>> Anyone know why this happens?
>
> Are you spawning/backgrounding jobs in the script?

Here is the script, it is a fairly simple start/stop/reset script that
was written by Jay Farschman. One other question I had about this
script is what the "$PROG" variable in the stop() function is for.

#!/bin/sh
#
# swatchrc This shell script takes care of starting and stopping
# swatch.
#
# chkconfig: 2345 81 31
# description: Swatch is a System WATCHdog program that we are
# using here to block repeated failed ssh logins.
# processname: swatch

# Replace --tail-file with the file you wish to watch, see /etc/swatch/swatchrc

RETVAL=0
test -x /usr/bin/swatch || exit 0
start(){
echo "Starting swatch"
# Spawn a new swatch program
/usr/bin/swatch --daemon --config-file=/etc/swatch/swatchrc
--tail-file=/u
sr/local/ha-tomcat/logs/catalina.out
--pid-file=/var/run/swatch.pid
echo $PID
return $RETVAL
}
stop () {
# stop daemon
echo "Stopping swatch:" $PROG
kill -9 `cat /var/run/swatch.pid`
rm -f /var/run/swatch.pid
killall tail
return $RETVAL
}
restart () {
stop
start
RETVAL=$?
return $RETVAL
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
RETVAL=1
esac
exit $RETVAL
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-24-2008, 04:01 PM
"Sean Carolan"
 
Default Certain scripts "hang" the terminal on logout

> You might try to change the script in init.d to append "</dev/null
>>/dev/null 2>&1" at the line that starts the daemon, this might force
> it to detach itself from the terminal.

This appears to have corrected the issue, thank you very much for the reply.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 04:12 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org