Operating System - HP-UX
1752472 Members
6823 Online
108788 Solutions
New Discussion юеВ

Re: Problem Start Shell in background

 
cocoluigi
New Member

Problem Start Shell in background

Hello..
when I start a shell in background ex:
nohup myshell.sh &
return
[1] + Stopped (tty output) nohup myshell.sh &
more nohup.out
Not a terminal

this is my .profile

# @(#)B.11.11_LR
# Default user .profile file (/usr/bin/sh initialization).

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

# Set up the search paths:
PATH=$PATH:.

# Set up the shell environment:
set -u
trap "echo 'logout'" 0

# Set up the shell variables:
EDITOR=vi
export EDITOR


How can I solve this problem
Thanks in winter!!!
12 REPLIES 12

Re: Problem Start Shell in background

Why are you showing us your .profile? I think we would be more interested in the contents of myshell.sh

HTH

Duncan

I am an HPE Employee
Accept or Kudo
cocoluigi
New Member

Re: Problem Start Shell in background

this is content of myshell.sh

#########################

. $HOME/.profile
sqlplus -S user/user <spool query.log
@/export/home/oracle/query.sql
spool off
EOF

########################

Re: Problem Start Shell in background

(I won't comment on the sense of sourcing a .profile in a non-interactive script)

Then the problem is the tset commands in your .profile

Chnage your .profile to look like this:

# @(#)B.11.11_LR
# Default user .profile file (/usr/bin/sh initialization).

if /usr/bin/tty -s
then
# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs
fi

# Set up the search paths:
PATH=$PATH:.

# Set up the shell environment:
set -u
trap "echo 'logout'" 0

# Set up the shell variables:
EDITOR=vi
export EDITOR




HTH

Duncan

I am an HPE Employee
Accept or Kudo
cocoluigi
New Member

Re: Problem Start Shell in background

Sorry!! the problem persists
However, many thanks....

Re: Problem Start Shell in background

oops sorry...

try replacing

if /usr/bin/tty -s

with

if [ -o interactive ]



HTH

Duncan

I am an HPE Employee
Accept or Kudo
Sandman!
Honored Contributor

Re: Problem Start Shell in background

How about the nesting the test for the TERM variable within the test for interactive or batch mode of operation i.e.

if [ -t ]; then
if [ "$TERM" = ""]; then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
fi
Peter Nikitka
Honored Contributor

Re: Problem Start Shell in background

Hi,

read Sandman's first line as
if [ -t 1 ]; then

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
cocoluigi
New Member

Re: Problem Start Shell in background

Thanks everyone! ! I have tried all your suggestions
But I did not understand why the problem persists
Peter Nikitka
Honored Contributor

Re: Problem Start Shell in background

Hi,

what about attaching your modified $HOME/.profile ?

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"