как преобразовать рабочий процесс в nohup и сохранить файл журнала

Я мог ошибиться в серверной среде, но Joel K корректен в этом, resolv.conf перезаписывается DCHP. Однако файл/etc/network/interfaces может переопределить интерфейс. при выполнении сервера необходимо, вероятно, добавить всю ту информацию статически так или иначе

Вот основная статья об интерфейсах

2
задан 22 August 2013 в 00:10
3 ответа

Отказ от процесса и перенаправление STDOUT из уже зарезервированного процесса невозможно для большинства пользователей. Этот SO-ответ довольно хорошо освещает тему.

Отделить процесс от текущей оболочки не так сложно: вы ищете disown . Из справочной страницы:

SIGNALS

....

       The shell exits by default upon receipt of a SIGHUP.   Before  exiting,
       an  interactive  shell  resends  the  SIGHUP  to  all  jobs, running or
       stopped.  Stopped jobs are sent SIGCONT to ensure that they receive the
       SIGHUP.   To  prevent the shell from sending the signal to a particular
       job, it should be removed from the jobs table with the  disown  builtin
       (see  SHELL  BUILTIN  COMMANDS  below)  or marked to not receive SIGHUP
       using disown -h.

....

SHELL BUILTIN COMMANDS

....

       disown [-ar] [-h] [jobspec ...]
              Without options, each jobspec  is  removed  from  the  table  of
              active  jobs.   If jobspec is not present, and neither -a nor -r
              is supplied, the shell's notion of the current job is used.   If
              the -h option is given, each jobspec is not removed from the ta‐
              ble, but is marked so that SIGHUP is not sent to the job if  the
              shell  receives a SIGHUP.  If no jobspec is present, and neither
              the -a nor the -r option is supplied, the current job  is  used.
              If no jobspec is supplied, the -a option means to remove or mark
              all jobs; the -r option without  a  jobspec  argument  restricts
              operation  to running jobs.  The return value is 0 unless a job‐
              spec does not specify a valid job.

Если вы хотите узнать больше о том, что на самом деле делают nohup и disown , вы можете проверить этот вопрос. (отказ от ответственности: бессовестная самореклама)

5
ответ дан 3 December 2019 в 10:06

Looks like you are close:

 nohup sh custom-script.sh > custom-out.log &

From here

-1
ответ дан 3 December 2019 в 10:06

Насколько я понимаю, вы в настоящее время используете ОС на базе Linux, но для записи и в случае, если кто-то использует Solaris 10 или новее, найдите эту страницу при поиске решения, Solaris nohup реализует то, что вы ищете:

$ command some_argument
...
^Z[1] + Stopped (SIGTSTP)        command some_argument
$ bg
[1]     command some_argument&
$ jobs -l
[1] + 1061       Running                 command some_argument
$ nohup -p 1061
Sending output to nohup.out
$ exit
0
ответ дан 3 December 2019 в 10:06

Теги

Похожие вопросы