From: surinder makkar <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [ilugd]: How to redirect the pid of a process when running it in >background
Date: Mon, 27 Jan 2003 03:40:01 -0800 (PST)
HI List,
I am running a command in background on Unix(Solaris)
by suffixing it with & and in order for this command
to run uniterrupted, I am prefixing it with nohup. I
want the pid returned by it to be trapped in some
file. The command is something like this:--
$ nohup rmiregistry& > abc.out
The problem is that it returns the pid on the console
but does not redirect it to the file. I have tried
this command in many different styles eg:--
$ nohup rmiregistry& 2>abc.out
$ nohup rmiregistry& 1>abc.out
$ nohup rmiregistry& 0>abc.out
and some other stupid combinations but nothing seems
to be working
Suggest me a solution
No PID is coming in the nohup as well. Infact even if
i try the command without nohup option this way:--
$ rmiregistry& > abc.out
still there is no output in the file. This is probably
because the PID returned is not the output of the
command, thats why. Please suggest a solution
Thanks in advance
Try running the following commands $ nohup rmiregistry& > abc.out
as u were running it Immediately after this $ echo $! > PidFile PidFile should contain the PID of the required process
<quote>From man bash
! Expands to the process ID of the most recently executed background (asynchronous) command.
</quote>
You may like to read up further the "jobs section" of man bash you will find it contains much more information pertaining to your needs.
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
================================================
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header. Check archives at http://www.mail-archive.com/ilugd%40wpaa.org