output nohup file containg the PID


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting output nohup file containg the PID
# 1  
Old 05-11-2009
output nohup file containg the PID

Hi to everybody.

Is it possible to nohup a process and redirect the output to a file containing the PID?

E.g. if

nohup filename > out.nohup

associate the PID=8074 to filename, is it possible to call the output file something like out_8074.nohup instead of out.nohup? By this way it would be easy to kill the running process.

I tried the following and seems to work, but I don't know why:

nohup filename > out\_`expr $$ + 10`&

Can anyone explain me why or post a better solution?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Kill nohup process with changing PID

Hi there! I have a tricky problem concerning a nohup process: I started a python2.7 script which loops over a function. At the end it restarts the function. Due to a mistake I'm now having a never ending nohup process that I have to kill. I started the program execution with: >>nohup... (4 Replies)
Discussion started by: Lydia
4 Replies

2. Shell Programming and Scripting

Help with finding the exit status of a 'nohup' command using 'PID'.

Hello All, I need to run a set of scripts, say 50 of them, parallely. I'm running these 50 scripts, from inside a script with the help of 'nohup' command. 1.The fifty scripts are stored in a separate file. 2.In a master script, i'm reading every line of the file through loop and executing... (4 Replies)
Discussion started by: SriRamKrish
4 Replies

3. Shell Programming and Scripting

I need to save a pid of a child started with $: su <user> -c “nohup …”

Hello, I want to save pid of a child process but I get empty file. su myuser -c "nohup ./mydaemon.sh >/dev/null 2>&1 & print $! > mydaemon.pid" This one works: nohup ./mydaemon.sh >/dev/null 2>&1 & print $! > mydaemon.pid Please help. Thank you in advance. (2 Replies)
Discussion started by: vincegata
2 Replies

4. Shell Programming and Scripting

Saving nohup output to a file other than nohup.out

Shell : bash OS : Oracle Linux 6.4 I want to save the ouput of a nohup command to file other than nohup.out . Below are my 3 attempts. For both Attempt1 and Attempt2 , the redirection logs the output correctly to the output file. But I get the error "ignoring input and redirecting stderr to... (7 Replies)
Discussion started by: kraljic
7 Replies

5. UNIX for Dummies Questions & Answers

How do I send output of a background process to a file other than nohup.out?

I have a question. I will be running a background process using nohup and & command at end. I want to send output to a file say myprocess.out. So will this command work? nohup myprocess.ksh > myprocess.out & Thanks in advance guys !!! :) (3 Replies)
Discussion started by: vx04
3 Replies

6. Shell Programming and Scripting

nohup output on screen for some time

Hi, I'm executing a binary with nohup in a menu(shellscript) and output is going to nohup.out fine. I need few lines of nohup.out should be displayed on screen so that I will come to know the process is successfully started and continue with other options in my menu. Thanks in advance. (3 Replies)
Discussion started by: axes
3 Replies

7. AIX

kill -3 <PID> ... where the output file goes?

Hi all, I am generating the coredump of my JBoss, and by default it puts it in to a particular directory. i.e. JBOSS_HOME/. I would like this output file to be created, lets say in /tmp/dump/. I tried the following: kill -3 9404940>/tmp/dump/out.txt But it created... (3 Replies)
Discussion started by: haroon_a
3 Replies

8. Shell Programming and Scripting

pid of nohup process

I want to print the pid of a nohup process to a file so later I can use the list of pid's in that file to stop the background processes again. I use ksh on AIXv5.3: nohup /start/script.ksh 1>/dev/null 2>&1 print $$ > .pid nohup /start/script2.ksh 1>/dev/null 2>&1 print $$ >> .pid But... (2 Replies)
Discussion started by: rein
2 Replies

9. Shell Programming and Scripting

Create Summary file containg information

Folks, I have multiple files in a folder containing some information (there is around 100 of them). What I would like to do would be able to import some of the information into a summary text file so that it will be easier to read a glance. The name of the files all start with the naming... (4 Replies)
Discussion started by: lodey
4 Replies

10. UNIX for Dummies Questions & Answers

I want to copy the text output from a 'nohup.out' file.

Hello, I have a nohup.out file that, when executed, outputs a spreadsheet file with four-to-seven columns of number. I want to copy this output (in its entirety), so that I could then paste it on excel@ , or Notepad@. Please help, thanks. (3 Replies)
Discussion started by: Iamthe great
3 Replies
Login or Register to Ask a Question
NOHUP(1)						    BSD General Commands Manual 						  NOHUP(1)

NAME
nohup -- invoke a utility immune to hangups SYNOPSIS
nohup [--] utility [arguments] DESCRIPTION
The nohup utility invokes utility with its arguments and at this time sets the signal SIGHUP to be ignored. If the standard output is a ter- minal, the standard output is appended to the file nohup.out in the current directory. If standard error is a terminal, it is directed to the same place as the standard output. Some shells may provide a builtin nohup command which is similar or identical to this utility. Consult the builtin(1) manual page. ENVIRONMENT
The following variables are utilized by nohup: HOME If the output file nohup.out cannot be created in the current directory, the nohup utility uses the directory named by HOME to create the file. PATH Used to locate the requested utility if the name contains no '/' characters. EXIT STATUS
The nohup utility exits with one of the following values: 126 The utility was found, but could not be invoked. 127 The utility could not be found or an error occurred in nohup. Otherwise, the exit status of nohup will be that of utility. SEE ALSO
builtin(1), csh(1), signal(3) STANDARDS
The nohup utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible. BUGS
Two or more instances of nohup can append to the same file, which makes for a confusing output. BSD
July 19, 2001 BSD