Autostart

From Freephile Wiki
Jump to navigation Jump to search

When your machine turns on or reboots, you want certain things to happen automatically. If the 'machine' is a web server hosting websites defined by Apache and also a database server running MySQL, then naturally you would want Apache and MySQL to start automatically. In SysV-style systems that still use init and the rc.d run levels, you can use either chkconfig[1] (RedHat and derivatives) or sysv-rc-conf or update-rc.d[2]for Debian variants to make that permanent. The old SysV style init has now largely been replaced by systemd, so this article is just to guide you through some of the equivalents across multiple ways of doing init.

List services[edit | edit source]

So what are the services controlled by init[3][4] scripts?

# the easy way (if somewhat non-specific)
ls -l /etc/rc.d/init.d/
# On Ubuntu 14.04 you'll have the 'service' command
# service --status-all runs all init scripts, in alphabetical order, with the status command. This option only calls status for sysvinit jobs
service --status-all
# upstart jobs can be queried in a similar manner with initctl list
initctl list
# on older Ubuntu like 14.04, you probably also have update-rc.d, but that doesn't have a 'list' command
# You could 'manually' search all the init scripts for the right runlevel
grep -i 'runlevel' /etc/init/*| awk '!/#/ && /start on/ && /2/ {gsub("/"," "); print $0  }' | cut -d ' ' -f4-
# or 
grep -i 'runlevel' /etc/init/* | awk '/start on/ && /2/ {gsub("/"," "); gsub(":", " ");gsub(".conf"," "); print $3  }'
# the RedHat way (using chkconfig)
chkconfig --list
# for newer systemd controlled systems
systemctl list-units

Here is an example list of the services you might find on your machine:

  1. NetworkManager
  2. acpid
  3. anacron
  4. atd
  5. auditd
  6. autofs
  7. avahi-daemon
  8. avahi-dnsconfd
  9. bluetooth
  10. capi
  11. clvmd
  12. cman
  13. cmirror
  14. conman
  15. cpuspeed
  16. crashplan
  17. crond
  18. cups
  19. dc_client
  20. dc_server
  21. dnsmasq
  22. dund
  23. ebtables
  24. firstboot
  25. gfs
  26. gfs2
  27. gpm
  28. haldaemon
  29. hidd
  30. hplip
  31. httpd
  32. ip6tables
  33. ipmi
  34. iptables
  35. irda
  36. irqbalance
  37. iscsi
  38. iscsid
  39. isdn
  40. kdump
  41. kudzu
  42. libvirt-guests
  43. libvirtd
  44. lm_sensors
  45. luci
  46. lvm2-monitor
  47. mcstrans
  48. mdmonitor
  49. mdmpd
  50. messagebus
  51. modclusterd
  52. multipathd
  53. mysql51-mysqld
  54. mysql55-mysqld
  55. mysqld
  56. nagios
  57. netconsole
  58. netfs
  59. netplugd
  60. network
  61. networker
  62. nfs
  63. nfslock
  64. nginx
  65. nrpe
  66. nscd
  67. ntop
  68. ntpd
  69. nxserver
  70. oddjobd
  71. openais
  72. openwsmand
  73. pand
  74. pcscd
  75. piranha-gui
  76. portmap
  77. postfix
  78. postgresql
  79. psacct
  80. pulse
  81. qdiskd
  82. rawdevices
  83. rdisc
  84. readahead_early
  85. readahead_later
  86. restorecond
  87. rgmanager
  88. rhnsd
  89. rhsmcertd
  90. ricci
  91. rpcgssd
  92. rpcidmapd
  93. rpcsvcgssd
  94. rsyslog
  95. saslauthd
  96. sblim-sfcb
  97. scsi_reserve
  98. setroubleshoot
  99. slinksc
  100. smartd
  101. snmpd
  102. snmptrapd
  103. squid
  104. sshd
  105. svnserve
  106. syslog
  107. tomcat5
  108. tux
  109. vncserver
  110. wdaemon
  111. winbind
  112. wpa_supplicant
  113. xfs
  114. xinetd
  115. ypbind
  116. yum-updatesd

Enable/Disable/Start/Stop/Status a service[edit | edit source]

# for older systems using System V style init
chkconfig apache on|off|start|stop|status
# for newer systemd controlled systems
systemctl enable|disable|start|stop|status <servicename>.service

More[edit | edit source]

References[edit source]