• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

daemon Command Examples in Linux

by Deepika

In Linux, the daemon command is used to start a program as a daemon process, which is a background process that is detached from the terminal and runs independently of the user’s session. Daemon processes are typically used for long-running tasks or services that need to run continuously in the background.

For example, to run a command as a daemon, you could use the following command:

# daemon --name="name" command

This will start the command as a daemon process. The daemon command will fork the process and then exit, leaving the daemon process running in the background.

It is important to note that the daemon command is not a built-in shell command, but rather a separate utility that is typically installed as part of the daemon package. This package is usually available in the default repositories of most Linux distributions and can be installed using the package manager.

daemon Command Examples

1. Run a command as a daemon:

# daemon --name="name" command

2. Run a command as a daemon which will restart if the command crashes:

# daemon --name="name" --respawn command

3. Run a command as a daemon which will restart if it crashes, with two attempts every 10 seconds:

# daemon --name="name" --respawn --attempts=2 --delay=10 command

4. Run a command as a daemon, writing logs to a specific file:

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

5. Kill a daemon (SIGTERM):

# daemon --name="name" --stop

6. List daemons:

# daemon --list

Filed Under: Linux

Some more articles you might also be interested in …

  1. flatpak-builder Command Examples in Linux
  2. How To Generate An CentOS/RHEL 6 UEFI Bootable ISO Image
  3. How to Identify NIS Authenticated Users
  4. ssh-copy-id Command Examples in Linux
  5. fstrim Command Examples in Linux
  6. aws-shell: command not found
  7. dunstify Command Examples in Linux
  8. How to configure EPEL repository in OEL 7
  9. acpi: command not found
  10. mons: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright