LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

daemonize

run commands as Unix daemons

TLDR

Run a command as a daemon
$ daemonize [command] [arguments]
copy
Write PID to specified file
$ daemonize -p [path/to/pidfile] [command] [arguments]
copy
Use a lock file for single instance
$ daemonize -l [path/to/lockfile] [command] [arguments]
copy
Run as a specific user
$ sudo daemonize -u [user] [command] [arguments]
copy

SYNOPSIS

daemonize [options] command [arguments]

DESCRIPTION

daemonize runs a command as a Unix daemon. It handles the standard daemonization process: forking twice, creating a new session, changing to root directory, and closing standard file descriptors.Useful for programs that don't daemonize themselves but need to run as background services.

PARAMETERS

-p pidfile

Write daemon PID to file
-l lockfile
Use lock file for single instance
-u user
Run as specified user
-c directory
Change to directory before running
-o file
Redirect stdout to file
-e file
Redirect stderr to file

INSTALL

sudo apt install daemonize
copy
sudo dnf install daemonize
copy
sudo zypper install daemonize
copy
brew install daemonize
copy
nix profile install nixpkgs#daemonize
copy

CAVEATS

The command must be specified with an absolute path. For modern systems, systemd services are often preferred. Lock files prevent multiple instances but require cleanup on crashes.

SEE ALSO

daemon(1), nohup(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid