nohup (script1.ksh ; script2.ksh ) & doesn't work

nohup (script1.ksh ; script2.ksh ) & doesn't work

Post by Michael » Mon, 25 Apr 2005 06:12:52



hi,

I am trying to start 2 processes , one after the other but
nohup (script1.ksh ; script2.ksh ) &  doesn't work.

man nohup indicates that It should work and I know how to bypass this
problem , I am just wondering why it doesn't work.

thanks
Michael

 
 
 

nohup (script1.ksh ; script2.ksh ) & doesn't work

Post by Chris F.A. Johnso » Mon, 25 Apr 2005 06:21:03



> hi,

> I am trying to start 2 processes , one after the other but
> nohup (script1.ksh ; script2.ksh ) &  doesn't work.

> man nohup indicates that It should work and I know how to bypass this
> problem , I am just wondering why it doesn't work.

    '(' is not a command.

NAME
       nohup - run a command immune to hangups, with output to a non-tty

SYNOPSIS
       nohup COMMAND [ARG]...

--
    Chris F.A. Johnson                     <http://cfaj.freeshell.org>
    ==================================================================
    Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
    <http://www.torfree.net/~chris/books/ssr.html>

 
 
 

nohup (script1.ksh ; script2.ksh ) & doesn't work

Post by Michael » Mon, 25 Apr 2005 06:56:52


hi ,
according to man nohup : "
 Be careful to place punctuation properly.  For example, in the command
      form:           nohup command1; command2
      nohup applies only to command1.  To correct the problem, use the
      command form:           nohup (command1; command2)
"

thanks
Michael

 
 
 

nohup (script1.ksh ; script2.ksh ) & doesn't work

Post by Stephane CHAZELA » Tue, 26 Apr 2005 03:49:17


2005-04-23, 14:56(-07), Michael A:
Quote:> hi ,
> according to man nohup : "
>  Be careful to place punctuation properly.  For example, in the command
>       form:           nohup command1; command2
>       nohup applies only to command1.  To correct the problem, use the
>       command form:           nohup (command1; command2)
> "

[...]

That man page must refer to the nohup built into the csh or tcsh
shells. As "(" is a shell construct, of course /usr/bin/nohup
can't cope with it.

If your shell doesn't have a built-in nohup, you need

nohup sh -c 'command1; exec command2'

--
Stphane

 
 
 

1. ksh children won't die ; exec doesn't work properly; ksh -p

I'm having problems with Korn shell's exec ...I have converted
some old csh scripts to ksh, which seems to have worked fine,
except for two problems:-

(1) When I kill the parent process - the child processes do not
all die!!! (This one is driving me up the wall).  

Complication: I need to keep one child alive (I use nohup ... & for this)
As the children did not die with their parent, I tried to
kill them in the parent's interupt routine with kill -hup 0
- unfortunately this results in an infinite loop into the
interupt routine ...of course!

(2) When I exec another ksh script, instead of overwriting
the current process - a child process is spawned....why
for heaven sake???

One more question.  What exactly does ksh -p do for me (I thought
it just prevent the ksh reading my .profile, and so would
be good to place on the first line of my scripts, however according
to "Unix Desktop Guide to the Korn Shell" ( a better book than
Korn book for most things IMHO) it described this option as
"Set protected mode" but fails to elaborate further.

I'd be grateful for any help or suggestions.  (E-mail response
would be preferred, but I'll try to check back here.)

--
"As the leader in the cellular industry and a company that places top priority
on the interests and concerns of our customers and the public, we intend to
address these concerns in a straightforward, responsible manner.
..First, let me assure you that all of our products are safe."- Pres. Motorola GSS

2. unknown data format dd ebcdic

3. Nohup doesn't work as I need with ksh on Solaris 2.6

4. Tru64 Unix 5.0 vs. NCD XTerminals

5. KSH .profile problem - Why doesn't this work and how to make it work?

6. test

7. > ksh children won't die ; exec doesn't work properly (solution)

8. Need suggestions for 28.8 modem to use with Mgetty

9. Why doesn't this work ?? (ksh)

10. ksh question: ^Z doesn't work?

11. How come the kermit rz macro doesn't work under ksh?

12. ksh magic stuff doesn't seem to work for me

13. Why doesn't this ksh script work?