N
N
Nemo_by2017-03-23 00:43:13
linux
Nemo_by, 2017-03-23 00:43:13

How to run a program as a daemon in Linux?

At work, there are devices running Linux (a modified version of RH). This device runs software that connects to another device. When starting and running the software (when it works in the terminal it says: Press Ctrl + x to exit) it constantly hangs in the terminal and does not block the terminal, which is very good. Is there any software that can run the software in this software and then block the terminal? Or how to run this software as a daemon? I tried to run as a standard file-based daemon type skeleton - it did not help.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
mureevms, 2017-03-23
@Nemo_by

Regarding daemonization - Forever, Supervisor, Systemd. If the OS is older than version 7, then systemd is not in it. I would use supervisor myself.
If you run it manually, then as already said command &, nohup command. There are also screen and tmux softwares.

K
Kastuś, 2017-03-23
@Gytim

If I understand correctly, you just need to run the program in the background, and not block the terminal
The easiest option:
nohup * program_name *
if you need to save the logs then add
> log.txt

V
vreitech, 2017-03-23
@fzfx

press "ctrl + z";
execute "bg";
block the terminal.

S
Sly_tom_cat ., 2017-03-23
@Sly_tom_cat

A daemon is one that is not associated with the parent process. Classically this is done by double forking the process to be daemonized.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question