Daemons

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to: navigation, search

A daemon (also known as background processes) is a Linux or UNIX program that runs in the background. Almost all daemons have names that end with the letter "d". For example, httpd the daemon that handles the Apache server, or, sshd which handles SSH remote access connections. Linux often start daemons at boot time. Shell scripts stored in /etc/init.d directory are used to start and stop daemons.

Typical functions of daemons

  • Open network port (such as port 80) and respond to network requests.
  • Monitor system such as hard disk health or RAID array.
  • Run scheduled tasks such as cron.

List of service daemons for Linux and Unix-like systems

  • amd - Auto Mount Daemon
  • anacron - Executed delayed cron tasks at boot time
  • apmd - Advanced Power Management Daemon
  • atd - Runs jobs queued using the at tool
  • autofs - Supports the automounter daemon allowing mount and unmount of devices on demand
  • crond - The task scheduler daemon
  • cupsd - CUPS printer daemon
  • dhcpd - Dynamic Host Configuration Protocol and Internet Bootstrap Protocol Server
  • ftpd - FTP Server Daemon
  • gated - routing daemon that handles multiple routing protocols and replaces routed and egpup
  • httpd - Web Server Daemon
  • inetd - Internet Superserver Daemon
  • imapd - An imap server daemon
  • lpd - Line Printer Daemon
  • memcached - In-memory distributed object caching daemon
  • mountd - mount daemon
  • mysql - Database server daemon
  • named - A DNS server daemon
  • nfsd - Network File Sharing Daemon
  • nfslock - Used to start and stop nfs file locking services
  • nmbd - Network Message Block Daemon
  • ntpd - Network Time Protocol service daemon
  • postfix - A mail transport agent used as a replacement for sendmail
  • postgresql - Database server daemon
  • routed - Manages routing tables
  • rpcbind - Remote Procedure Call Bind Daemon
  • sendmail - A mail transfer agent Daemon
  • smbd - Samba (an SMB Server) Daemon
  • smtpd - Simple Mail Transfer Protocol Daemon
  • snmpd - Simple Network Management Protocol Daemon
  • squid - A web page caching proxy server daemon
  • sshd - Secure Shell Server Daemon
  • syncd - Keeps the file systems synchronized with system memory
  • syslogd - System logging daemon
  • tcpd - Service wrapper restricts access to inetd based services through hosts.allow and hosts.deny
  • telnetd - Telnet Server daemon
  • vsftpd - Very Secure FTP Daemon
  • webmin - Web based administration server daemon
  • xinetd - Enhanced Internet Superserver Daemon
  • xntd - Network Time Server Daemon

How do I start / stop / restart daemons for the shell prompt?

You need to use the service command as follows[1][2]::

service daemon-name-here start
service daemon-name-here stop
service daemon-name-here restart

In this example, start, stop, and restart httpd daemon:

service httpd start
service httpd stop
service httpd restart

Sample outputs:

Fig.01: service command in action

How do I see list of all running daemons?

To see the status all installed daemons, enter:

service --status-all

Sample outputs from CentOS Linux development server:

acpid (pid 3914) is running...
anacron is stopped
atd (pid  4433) is running...
auditd (pid  3537) is running...
automount (pid 4174) is running...
Avahi daemon is not running
Avahi DNS daemon is not running
hcid (pid 3821) is running...
sdpd (pid 3827) is running...
collectl is stopped
conmand is stopped
cpuspeed is stopped
crond (pid  4386) is running...
cupsd is stopped
dc_client is stopped
dc_server is stopped
dnsmasq is stopped
dovecot is stopped
dund is stopped
gpm (pid  4372) is running...
hald (pid 4094) is running...
hidd (pid 4144) is running...
httpd is stopped
irattach is stopped
irqbalance (pid 3686) is running...
iscsid (pid  2775) is running...
iscsid (pid  2775) is running...
Kdump is not operational
krb524d is stopped
libvirtd is stopped
lighttpd is running for example.com domain.
lighttpd is running for example.net domain.
mcstransd (pid 2932) is running...
memcached (pid 39605) is running...
dbus-daemon (pid 3802) is running...
multipathd is stopped
mysqld (pid 4319) is running...
named (pid  21265) is running...
netplugd is stopped
Configured devices:
lo br0 br1 eth0 eth1
Currently active devices:
lo eth0 eth1 br0 br1
NetworkManager is stopped
rpc.mountd is stopped
nfsd is stopped
mcstransd (pid 2932) is running...
mdadm is stopped
mdmpd is stopped
memcached (pid 39605) is running...
dbus-daemon (pid 3802) is running...
multipathd is stopped
mysqld (pid 4319) is running...
named (pid  21265) is running...
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
rpc.statd is stopped
nscd is stopped
ntpd (pid  4240) is running...
pcscd (pid  3905) is running...
sendmail (pid  4354) is running...
setroubleshootd (pid  3813) is running...
smartd (pid 4491) is running...
smbd is stopped
nmbd is stopped
snmpd (pid  4191) is running...
squid (pid  13123) is running...
openssh-daemon (pid  4217) is running...
syslogd (pid  3563) is running...
klogd (pid  3566) is running...
tux is stopped
vsftpd is stopped
winbindd is stopped
wpa_supplicant is stopped
xfs (pid  4418) is running...
xinetd (pid  4229) is running...
ypbind is stopped
yum-updatesd (pid 4525) is running...

Sample outputs from my Ubuntu Linux desktop systems:

 [ ? ]  acpi-support
 [ ? ]  acpid
 [ ? ]  alsa-mixer-save
 [ ? ]  anacron
 [ + ]  apache2
 [ + ]  apparmor
 [ ? ]  apport
 [ ? ]  arpwatch
 [ ? ]  atd
 [ ? ]  aumix
 [ + ]  bind9
 [ ? ]  binfmt-support
 [ + ]  bluetooth
 [ - ]  bootlogd
 [ ? ]  bridge-network-interface
 [ - ]  brltty
 [ ? ]  console-setup
 [ ? ]  cron
 [ + ]  cups
 [ ? ]  dbus
 [ ? ]  dmesg
 [ ? ]  dns-clean
 [ ? ]  failsafe-x
 [ - ]  fancontrol
 [ ? ]  gdm
 [ - ]  grub-common
 [ ? ]  gssd
 [ ? ]  hddtemp
 [ ? ]  hostname
 [ ? ]  hwclock
 [ ? ]  hwclock-save
 [ ? ]  idmapd
 [ ? ]  irqbalance
 [ ? ]  iscsi-network-interface
 [ - ]  kerneloops
 [ ? ]  killprocs
 [ ? ]  libvirt-bin
 [ - ]  lighttpd
 [ - ]  lm-sensors
 [ + ]  memcached
 [ ? ]  module-init-tools
 [ ? ]  mysql
 [ + ]  net-acct
 [ ? ]  network-interface
 [ ? ]  network-interface-security
 [ ? ]  network-manager
 [ ? ]  networking
 [ ? ]  ondemand
 [ + ]  open-iscsi
 [ ? ]  pcmciautils
 [ ? ]  plymouth
 [ ? ]  plymouth-log
 [ ? ]  plymouth-splash
 [ ? ]  plymouth-stop
 [ ? ]  portmap
 [ + ]  postfix
 [ ? ]  pppd-dns
 [ ? ]  procps
 [ + ]  pulseaudio
 [ ? ]  qemu-kvm
 [ ? ]  rc.local
 [ ? ]  resolvconf
 [ ? ]  rpc_pipefs
 [ - ]  rsync
 [ ? ]  rsyslog
 [ - ]  saned
 [ ? ]  screen-cleanup
 [ ? ]  sendsigs
 [ - ]  smartmontools
 [ ? ]  speech-dispatcher
 [ + ]  ssh
 [ ? ]  statd
 [ ? ]  stop-bootlogd
 [ ? ]  stop-bootlogd-single
 [ + ]  sysstat
 [ ? ]  udev
 [ ? ]  udev-finish
 [ ? ]  udevmonitor
 [ ? ]  udevtrigger
 [ ? ]  ufw
 [ ? ]  umountfs
 [ ? ]  umountnfs.sh
 [ ? ]  umountroot
 [ ? ]  unattended-upgrades
 [ - ]  urandom
 [ + ]  vmware
 [ + ]  vnstat
 [ - ]  wicd
 [ + ]  winbind
 [ ? ]  wpa-ifupdown
 [ - ]  x11-common

See also

References

  1. Red Hat / CentOS: Check / List Running Services
  2. Ubuntu / Debian Linux: Services Configuration Tool to Start / Stop System Services