← 返回命令列表

Linux command

daemon 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

daemon --name="[name]" [command]

Example

daemon --name="[name]" -r [command]

Example

daemon --name="[name]" -r --attempts=2 --delay=10 [command]

Example

daemon --name="[name]" --errlog=[path/to/file.log] [command]

Stop

daemon --name="[name]" --stop

List

daemon --list

说明

daemon turns other processes into proper Unix daemons. It handles the standard daemonization tasks: forking, creating a new session, changing directory, closing file descriptors, and optionally respawning on exit. Useful for running scripts or programs as background services without modifying the program itself.

参数

--name _name_
Daemon name for identification
-r, --respawn
Restart if the command exits
--attempts _n_
Maximum restart attempts
--delay _seconds_
Delay between restart attempts
--errlog _file_
Log stderr to file
--output _file_
Log stdout to file
--stop
Stop the named daemon
--list
List running daemons

FAQ

What is the daemon command used for?

daemon turns other processes into proper Unix daemons. It handles the standard daemonization tasks: forking, creating a new session, changing directory, closing file descriptors, and optionally respawning on exit. Useful for running scripts or programs as background services without modifying the program itself.

How do I run a basic daemon example?

Run `daemon --name="[name]" [command]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --name _name_ do in daemon?

Daemon name for identification