Sponsored Content
Full Discussion: nohup and background process
Top Forums UNIX for Advanced & Expert Users nohup and background process Post 302134832 by shahnazurs on Tuesday 4th of September 2007 02:06:28 AM
Old 09-04-2007
Hi,

nohup - no hangup

when you suffix with & for running some task, this task will run in background.
example

cat ex.txt|sort &

if you want to continue this job after you log out from your terminal, you can prefix with nohup

nohup cat ex.txt|nohup sort &

Thanks,
Shahnaz.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Why the nohup-ed background process always is "stopped" ?

I let a script A call script B. I used nohup a.sh &>/tmp/log & In script A it calls B directly, without any redirecting or nohup or background. However A is always "Stopped", while B is running correctly. Anybody knows why? thanks! -----Post Update----- BTW, if I don't use nohup... (1 Reply)
Discussion started by: meili100
1 Replies

2. Shell Programming and Scripting

Why the nohup-ed background process always is "stopped" ?

I let a script A call script B. I used nohup a.sh &>/tmp/log & In script A it calls B directly, without any redirecting or nohup or background. However A is always "Stopped", while B is running correctly. Anybody knows why? thanks! -----Post Update----- BTW, if I don't use nohup... (4 Replies)
Discussion started by: meili100
4 Replies

3. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

4. Shell Programming and Scripting

How to put FTP process as a background process/job in perl?

Hi, I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming. So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies

5. Shell Programming and Scripting

how do i execute nohup and background job inside the korn script for db2

load_cursor_stmt() { ls /db/admin/ddl/rmn01000/load_cursor*.sql|while read file do echo "${file}" `nohup db2 -tvf "$file" \&` done }Error: ------- /admin/ddl/rmn01000/load_cursor5.sql /db/admin/ddl/rmn01000/load_cursor6.sql + read file + echo... (3 Replies)
Discussion started by: Hangman2
3 Replies

6. Programming

Background (nohup * &) SSH command block possible?

Hello, I am trying to find a way to send several sequential commands via SSH to a remote box in a single command. Thoughts so far: 1) Can I put them into a function and call the function within the ssh command? e.g. ssh <targetserver> $(functionx) No - then it calls the function in... (4 Replies)
Discussion started by: doonan_79
4 Replies

7. Shell Programming and Scripting

How to stop nohup which is working background

Please I have run a background script using nohup please tell me way to stop this. Thanks in Advance (4 Replies)
Discussion started by: mumakhij
4 Replies

8. Shell Programming and Scripting

Nohup and background jobs

Hi All, Can someone help me in knowing the exact difference between nohup and &. The definition is quite clear but i only want to know if i run my job using & and in between i hung up my terminal. (10 Replies)
Discussion started by: Uinx_addic
10 Replies

9. 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

10. Shell Programming and Scripting

Make background process interact with fg process

Hi, I have written a menu driven shell script in which as per the choice, I run the another script on background. For eg: 1. get info 2)process info 3)modify info All the operations have different scripts which i schedule in background using &. However I wish to display the error... (0 Replies)
Discussion started by: ashima jain
0 Replies
nohup(1)						      General Commands Manual							  nohup(1)

NAME
nohup - Runs a utility ignoring hangups and quits SYNOPSIS
nohup utility [argument...] Note The C shell has a built-in version of the nohup command. If you are using the C shell, and want to guarantee that you are using the com- mand described here, you must specify the full path /usr/bin/nohup. See the csh(1) reference page for a description of the built-in com- mand. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: nohup: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
None OPERANDS
The name of a command to be invoked. Optional arguments required by the utility specified for invokation. DESCRIPTION
The nohup command runs utility, ignoring all hangups and QUIT signals. You can use this command to run programs in the background after logging off the system. To run a nohup command in the background, add an & (ampersand) to the end of the command. If nohup output is redirected to a terminal or is not redirected at all, the output is appended to the file nohup.out. If the file is cre- ated, the permission bits are set to Owner Read and Owner Write(600). If nohup.out is not writable in the current directory, the output is redirected to $HOME/nohup.out. If neither file can be created nor opened for appending, utility is not invoked. If standard error is a terminal, all output written to standard error is appended to the file receiving standard output. The nohup command accepts just one utility as an argument. To apply nohup to a pipeline or list of commands, enter the pipeline or list in a shell script file. Then run sh as utility using the following format: nohup sh -c file [Tru64 UNIX] You can also assign the shell file execute permission and run it as the utility in the form: nohup file NOTES
The term utility, rather than the term command, describes the argument to nohup because shell compound commands, pipelines, special built- in programs, and the like, cannot be handled directly. In addition, the term utility includes user application programs and shell scripts, not just the standard utilities. EXIT STATUS
The nohup command returns the following exit values: The specified utility was found, but could not be invoked. The error occurred in the nohup utility or the specified utility could not be found. The exit status is otherwise that of the utility. EXAMPLES
To leave a command running after logging out (sh only), enter: nohup find / -print & Shortly after you enter this, the following is displayed: 670 $ Sending output to nohup.out The process ID number changes to the background process started by the & (ampersand), in this case, 670. The $ (dollar sign) is the shell prompt. The message following informs you that the output from the find command is in the file nohup.out. Sending output... You can log out after you see these messages, even if the find command has not finished yet. If you are using csh, the built-in command nohup is executed instead of the system command. To execute the nohup system command, you must enter an absolute path. To do the same, but redirect the standard output to a different file, enter: nohup find / -print >filenames & This runs the find command and stores its output in a file named filenames. Now only the process ID and prompt are displayed. Wait for a second or two before logging out, because the nohup command takes a moment to start the command you specified. If you log out too quickly, utility may not run at all. Once utility has started, logging out does not affect it. To run more than one com- mand, use a shell script. For example, if you include the following shell script: comm -23 fi4 fi5 | comm -23 - fi6 | join -a1 - fi7 > comm.out and name it ncomm, you can run nohup for all of the commands in ncomm by entering: nohup sh ncomm If you assign ncomm Execute permission, you can obtain the same results by issuing the command: nohup ncomm To run this command in the background, enter: nohup ncomm & ENVIRONMENT VARIABLES
The following environment variables affect the execution of nohup: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. Determines the search path that will be used to locate the command to be invoked. FILES
Standard output and standard error file for nohup. SEE ALSO
Commands: csh(1), ksh(1), nice(1), Bourne shell sh(1b), POSIX shell sh(1p) Functions: sigaction(2) Standards: standards(5) nohup(1)
All times are GMT -4. The time now is 02:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy