NOHUP(1)                   POSIX Programmer's Manual                  NOHUP(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       nohup -- invoke a utility immune to hangups

SSYYNNOOPPSSIISS
       nohup _u_t_i_l_i_t_y [[_a_r_g_u_m_e_n_t...]]

DDEESSCCRRIIPPTTIIOONN
       The _n_o_h_u_p utility shall invoke the utility named by the _u_t_i_l_i_t_y operand
       with arguments supplied as the _a_r_g_u_m_e_n_t operands. At the time the named
       _u_t_i_l_i_t_y is invoked, the SIGHUP signal shall be set to be ignored.

       If standard input is associated with a terminal, the _n_o_h_u_p utility may
       redirect standard input from an unspecified file.

       If the standard output is a terminal, all output written by the named
       _u_t_i_l_i_t_y to its standard output shall be appended to the end of the file
       nnoohhuupp..oouutt in the current directory. If nnoohhuupp..oouutt cannot be created or
       opened for appending, the output shall be appended to the end of the
       file nnoohhuupp..oouutt in the directory specified by the _H_O_M_E environment
       variable. If neither file can be created or opened for appending,
       _u_t_i_l_i_t_y shall not be invoked. If a file is created, the file's
       permission bits shall be set to S_IRUSR | S_IWUSR.

       If standard error is a terminal and standard output is open but is not
       a terminal, all output written by the named utility to its standard
       error shall be redirected to the same open file description as the
       standard output. If standard error is a terminal and standard output
       either is a terminal or is closed, the same output shall instead be
       appended to the end of the nnoohhuupp..oouutt file as described above.

OOPPTTIIOONNSS
       None.

OOPPEERRAANNDDSS
       The following operands shall be supported:

       _u_t_i_l_i_t_y   The name of a utility that is to be invoked. If the _u_t_i_l_i_t_y
                 operand names any of the special built-in utilities in
                 _S_e_c_t_i_o_n _2_._1_4, _S_p_e_c_i_a_l _B_u_i_l_t_-_I_n _U_t_i_l_i_t_i_e_s, the results are
                 undefined.

       _a_r_g_u_m_e_n_t  Any string to be supplied as an argument when invoking the
                 utility named by the _u_t_i_l_i_t_y operand.

SSTTDDIINN
       Not used.

IINNPPUUTT FFIILLEESS
       None.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of
       _n_o_h_u_p:

       _H_O_M_E      Determine the pathname of the user's home directory: if the
                 output file nnoohhuupp..oouutt cannot be created in the current
                 directory, the _n_o_h_u_p utility shall use the directory named by
                 _H_O_M_E to create the file.

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments).

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

       _P_A_T_H      Determine the search path that is used to locate the utility
                 to be invoked. See the Base Definitions volume of
                 POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       The _n_o_h_u_p utility shall take the standard action for all signals except
       that SIGHUP shall be ignored.

SSTTDDOOUUTT
       If the standard output is not a terminal, the standard output of _n_o_h_u_p
       shall be the standard output generated by the execution of the _u_t_i_l_i_t_y
       specified by the operands. Otherwise, nothing shall be written to the
       standard output.

SSTTDDEERRRR
       If the standard output is a terminal, a message shall be written to the
       standard error, indicating the name of the file to which the output is
       being appended. The name of the file shall be either nnoohhuupp..oouutt or
       $$HHOOMMEE//nnoohhuupp..oouutt.

OOUUTTPPUUTT FFIILLEESS
       Output written by the named utility is appended to the file nnoohhuupp..oouutt
       (or $$HHOOMMEE//nnoohhuupp..oouutt), if the conditions hold as described in the
       DESCRIPTION.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

       126     The utility specified by _u_t_i_l_i_t_y was found but could not be
               invoked.

       127     An error occurred in the _n_o_h_u_p utility or the utility specified
               by _u_t_i_l_i_t_y could not be found.

       Otherwise, the exit status of _n_o_h_u_p shall be that of the utility
       specified by the _u_t_i_l_i_t_y operand.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       The _c_o_m_m_a_n_d, _e_n_v, _n_i_c_e, _n_o_h_u_p, _t_i_m_e, and _x_a_r_g_s utilities have been
       specified to use exit code 127 if an error occurs so that applications
       can distinguish ``failure to find a utility'' from ``invoked utility
       exited with an error indication''. The value 127 was chosen because it
       is not commonly used for other meanings; most utilities use small
       values for ``normal error conditions'' and the values above 128 can be
       confused with termination due to receipt of a signal. The value 126 was
       chosen in a similar manner to indicate that the utility could be found,
       but not invoked. Some scripts produce meaningful error messages
       differentiating the 126 and 127 cases. The distinction between exit
       codes 126 and 127 is based on KornShell practice that uses 127 when all
       attempts to _e_x_e_c the utility fail with [[EENNOOEENNTT]], and uses 126 when any
       attempt to _e_x_e_c the utility fails for any other reason.

EEXXAAMMPPLLEESS
       It is frequently desirable to apply _n_o_h_u_p to pipelines or lists of
       commands. This can be done by placing pipelines and command lists in a
       single file; this file can then be invoked as a utility, and the _n_o_h_u_p
       applies to everything in the file.

       Alternatively, the following command can be used to apply _n_o_h_u_p to a
       complex command:


           nohup sh -c '_c_o_m_p_l_e_x_-_c_o_m_m_a_n_d_-_l_i_n_e' </dev/null

RRAATTIIOONNAALLEE
       The 4.3 BSD version ignores SIGTERM and SIGHUP, and if ..//nnoohhuupp..oouutt
       cannot be used, it fails instead of trying to use $$HHOOMMEE//nnoohhuupp..oouutt.

       The _c_s_h utility has a built-in version of _n_o_h_u_p that acts differently
       from the _n_o_h_u_p defined in this volume of POSIX.1-2017.

       The term _u_t_i_l_i_t_y is used, rather than _c_o_m_m_a_n_d, to highlight the fact
       that shell compound commands, pipelines, special built-ins, and so on,
       cannot be used directly.  However, _u_t_i_l_i_t_y includes user application
       programs and shell scripts, not just the standard utilities.

       Historical versions of the _n_o_h_u_p utility use default file creation
       semantics. Some more recent versions use the permissions specified here
       as an added security precaution.

       Some historical implementations ignore SIGQUIT in addition to SIGHUP;
       others ignore SIGTERM. An early proposal allowed, but did not require,
       SIGQUIT to be ignored. Several reviewers objected that _n_o_h_u_p should
       only modify the handling of SIGHUP as required by this volume of
       POSIX.1-2017.

       Historical versions of _n_o_h_u_p did not affect standard input, but that
       causes problems in the common scenario where the user logs into a
       system, types the command:


           nohup make &

       at the prompt, and then logs out. If standard input is not affected by
       _n_o_h_u_p, the login session may not terminate for quite some time, since
       standard input remains open until _m_a_k_e exits. To avoid this problem,
       POSIX.1-2008 allows implementations to redirect standard input if it is
       a terminal. Since the behavior is implementation-defined, portable
       applications that may run into the problem should redirect standard
       input themselves. For example, instead of:


           nohup make &

       an application can invoke:


           nohup make </dev/null &

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _C_h_a_p_t_e_r _2, _S_h_e_l_l _C_o_m_m_a_n_d _L_a_n_g_u_a_g_e, _s_h

       The Base Definitions volume of POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s

       The System Interfaces volume of POSIX.1-2017, _s_i_g_n_a_l()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                             NOHUP(1)
