Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Process Hangup on exit of login 1

Status
Not open for further replies.

averagejoe1

Programmer
Nov 27, 2000
2
US
To anyone that can help:

SCO Unix 5.05:

I am trying to keep a C program running after I log out. The login will start the C program via a shell script. I have 2 logins, 1 of the logins will do what I want - but the other will cause the C program to hangup after I logout (which I know is usually the case). Both logins are established using the Borne shell (i have checked the passwd table). Both logins belong to the same group and the permissions on the file are:

rwsrwxr-x

The owner of the file has been set to 'bin'.

I know I can do the following:

1) Run the C program with 'nohup'
2) Change my shell for both logins to ksh
3) Add the command setpgrp within the C program.
4) Have a signal catcher within the C program to disregard the hangup signal.

The first 3 work w/o any problems - haven't tried 4 yet - however my dilemna is why the 1 login will cause the program to hangup while the other won't.

I have checked profiles etc ... - I just feel that I am missing something very obvious somewhere. The only difference that I have found is that the login that is not working is starting the C program with 'exec' while that other isn't - however removing it does not work either.

Thanks for any help.














 
Hi Joe,

Could you post the profiles of both logins?
Mike
michael.j.lacey@ntlworld.com
 
Mike:

Here is the information that you have requested. I apologize for not getting it quicker. Thanks for any help you can offer.

/* ************************************* */
/* .profile of the login that works fine */
/* ************************************* */

PATH=/usr/xxx/programs/bin:/bin:/usr/bin:/etc:/usr/ucb:$HOME/bin:/usr/bin/X11:.

export PATH
if [ "$TERM" = "dumb" ] || [ "$TERM" = "" ]
then
TERM=vt220;export TERM
fi
if [ -s "$MAIL" ]
then echo "$MAILMSG"
fi
news | pg
sleep 5
. /usr/xxx/conf/profile

/* ***************************************** */
/* . profile of the login that does not work */
/* ***************************************** */

trap "" 1 2 3 14 15

PATH=/usr/xxx/programs/bin:/bin:/usr/bin:/etc:/usr/ucb:$HOME/bin:/usr/bin/X11:.

export PATH

. /usr/xxx/conf/profile
exec /usr/xxx/conf/start
exit

/* ****************************************************** /
/* The following is /usr/xxx/conf/profile for BOTH logins /
/* ****************************************************** /

:
stty quit '^\' intr '^C' eof '^D'

PATH=$PATH:/usr/xxx/programs/bin/:$HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/gc
c/csn/cruntime:/usr/xxx/conf
export PATH
trap "" 1 2 3
umask 011

if [ -z "$MACHINE_NAME" ]; then
MACHINE_NAME=`uname`
machine_name=$MACHINE_NAME
export MACHINE_NAME machine_name
fi

if [ -z "$LOGNAME" ]; then
LOGNAME=`logname` # name of user who logged in
logname=$LOGNAME
export LOGNAME logname
fi

MAIL=/usr/spool/mail/$LOGNAME # mailbox location
export MAIL

if [ -z "$PWD" ]; then
PWD=$HOME # assumes initial cwd is HOME
export PWD
fi

if [ -f $HOME/.kshrc -a -r $HOME/.kshrc ]; then
ENV=$HOME/.kshrc # set ENV if there is an rc file
export ENV
fi

case "$0" in
-sh | -rsh | -ksh | -rksh)

# if not doing a hushlogin, issue message of the day, if the file is out there
[ "X$HUSHLOGIN" != "XTRUE" ] && [ -s /etc/motd ] && {
trap : 1 2 3
echo "" # skip a line
cat /etc/motd
trap "" 1 2 3
}

# if not doing a hushlogin, check mailbox and news bulletins
if [ "X$HUSHLOGIN" != "XTRUE" ]
then
[ -x /usr/bin/mail ] && { # if the program is installed
[ -s "$MAIL" ] && echo ""
}
if [ "$LOGNAME" != "root" -a -x /usr/bin/news ] # be sure it's t
here
then
news -n
fi
fi
;;
-su)
:
;;
esac

trap 1 2 3

#eval `tset -m ansi:ansi -m $TERM:\?${TERM:-ansi} -r -s -Q`

# If job control is enabled, set the suspend character to ^Z (control-z):
case $- in
*m*) stty susp '^z'
;;
esac

case $LOGNAME in # set up an appropriate prompt
root) PS1="{$LOGNAME@`uname`} ! # " ;;
*) PS1="{$LOGNAME@`uname`} ! $ " ;;
esac

export PS1

#/usr/bin/prwarn # issue a warning if password due to expire

VISUAL=vi

# Some local variables for convenience

local=/usr/local/bin
uucp=/usr/lib/uucp
public=/usr/spool/uucppublic
logs=/usr/spool/uucp/.Logs
locks=/usr/spool/locks
export local uucp public prog logs locks

[ -x /bin/mesg ] && mesg y # if mesg is installed...
#
# Some usefull functions
#

lc()
{
/bin/ls -lCq $*|more
}

ls()
{
/bin/ls -laFq $*|more
}

setenv()
{
exp_variable=$1
shift
eval "$exp_variable='$@'"
export $exp_variable
}

psg()
{
ps -ef | grep -i $* |grep -v grep
}

CDPATH=.:/usr:/usr/spool:/usr/lib:/usr/xxx:/home:/usr/local:/etc
export CDPATH

DBKEY=100
export DBKEY










 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top