You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

216 lines
5.6 KiB

  1. .\" Hey, Emacs! This is an -*- nroff -*- source file.
  2. .\" Authors: Ian Jackson, Miquel van Smoorenburg
  3. .TH "UPDATE\-RC.D" "8" "14 November 2005" "Debian Project" "sysv-rc"
  4. .SH "NAME"
  5. update\-rc.d \- install and remove System\-V style init script links
  6. .SH "SYNOPSIS"
  7. .B update\-rc.d
  8. .RI [ \-n ]
  9. .RI [ \-f ]
  10. .IB name " remove"
  11. .HP
  12. .B update\-rc.d
  13. .RI [ \-n ]
  14. .IB name " defaults"
  15. .HP
  16. .B update\-rc.d
  17. .RI [ \-n ]
  18. .IB name " disable|enable "
  19. .RI [ " S|2|3|4|5 " ]
  20. .SH "DESCRIPTION"
  21. .B update\-rc.d
  22. updates the System V style init script links
  23. .BI /etc/rc runlevel .d/ NNname
  24. whose target is the script
  25. .BI /etc/init.d/ name \fR.
  26. These links are run by
  27. .B init
  28. when it changes runlevels; they are generally used to start and stop
  29. system services such as daemons.
  30. .I runlevel
  31. is one of the runlevels supported by
  32. .BR init ", namely, " 0123456789S ", and "
  33. .I NN
  34. is the two\-digit sequence number that determines where in the sequence
  35. .B init
  36. will run the scripts.
  37. This manpage documents only the usage and behaviour of
  38. .BR update\-rc.d .
  39. For a discussion of the System V style init script arrangements please
  40. see
  41. .BR init (8)
  42. and the
  43. .IR "Debian Policy Manual" .
  44. .SH "INSTALLING INIT SCRIPT LINKS"
  45. update\-rc.d requires dependency and runlevel information to be
  46. provided in the init.d script LSB comment header of all init.d scripts.
  47. See the insserv(8) manual page for details about the LSB header format.
  48. When run with the
  49. .BR defaults
  50. option,
  51. .B update\-rc.d
  52. makes links named
  53. .BI /etc/rc runlevel .d/[SK] NNname
  54. that point to the script
  55. .BR /etc/init.d/ \fIname\fR,
  56. using runlevel and dependency information from the init.d script LSB
  57. comment header.
  58. If any files named
  59. .BI /etc/rc runlevel .d/[SK]?? name
  60. already exist then
  61. .B update\-rc.d
  62. does nothing.
  63. The program was written this way so that it will never
  64. change an existing configuration, which may have been
  65. customized by the system administrator.
  66. The program will only install links if none are present,
  67. i.e.,
  68. if it appears that the service has never been installed before.
  69. .P
  70. Older versions of
  71. .B update\-rc.d
  72. also supported
  73. .BR start
  74. and
  75. .BR stop
  76. options. These options are no longer supported, and are now
  77. equivalent to the
  78. .BR defaults
  79. option.
  80. .P
  81. A common system administration error is to delete the links
  82. with the thought that this will "disable" the service, i.e.,
  83. that this will prevent the service from being started.
  84. However, if all links have been deleted then the next time
  85. the package is upgraded, the package's
  86. .I postinst
  87. script will run
  88. .B update\-rc.d
  89. again and this will reinstall links at their factory default locations.
  90. The correct way to disable services is to configure the
  91. service as stopped in all runlevels in which it is started by default.
  92. In the System V init system this means renaming
  93. the service's symbolic links
  94. from
  95. .B S
  96. to
  97. .BR K .
  98. .P
  99. The script
  100. .BI /etc/init.d/ name
  101. must exist before
  102. .B update\-rc.d
  103. is run to create the links.
  104. .SH "REMOVING SCRIPTS"
  105. When invoked with the
  106. .I remove
  107. option, update\-rc.d removes any links in the
  108. .BI /etc/rc runlevel .d
  109. directories to the script
  110. .BI /etc/init.d/ name\fR.
  111. The script must have been deleted already.
  112. If the script is still present then
  113. .B update\-rc.d
  114. aborts with an error message.
  115. .P
  116. .B update\-rc.d
  117. is usually called from a package's post\-removal script when that
  118. script is given the
  119. .B purge
  120. argument.
  121. Any files in the
  122. .BI /etc/rc runlevel .d
  123. directories that are not symbolic links to the script
  124. .BI /etc/init.d/ name
  125. will be left untouched.
  126. .SH "DISABLING INIT SCRIPT START LINKS"
  127. When run with the
  128. .BR disable " [ " S|2|3|4|5 " ] "
  129. options,
  130. .B update\-rc.d
  131. modifies existing runlevel links for the script
  132. .BR /etc/init.d/ \fIname\fR
  133. by renaming start links to stop links with a sequence number equal
  134. to the difference of 100 minus the original sequence number.
  135. .P
  136. When run with the
  137. .BR enable " [ " S|2|3|4|5 " ] "
  138. options,
  139. .B update\-rc.d
  140. modifies existing runlevel links for the script
  141. .BR /etc/init.d/ \fIname\fR
  142. by renaming stop links to start links with a sequence number equal
  143. to the positive difference of current sequence number minus 100, thus
  144. returning to the original sequence number that the script had been
  145. installed with before disabling it.
  146. .P
  147. Both of these options only operate on start runlevel links of S, 2,
  148. 3, 4 or 5. If no start runlevel is specified after the disable or enable
  149. keywords, the script will attempt to modify links in all start runlevels.
  150. .SH "OPTIONS"
  151. .TP
  152. .I \-n
  153. Don't do anything, just show what we would do.
  154. .TP
  155. .I \-f
  156. Force removal of symlinks even if
  157. .BI /etc/init.d/ name
  158. still exists.
  159. .SH "EXAMPLES"
  160. Insert links using the defaults:
  161. .nf
  162. .B " update\-rc.d foobar defaults"
  163. The equivalent dependency header would have start and stop
  164. dependencies on $remote_fs and $syslog, and start in
  165. runlevels 2\-5 and stop in runlevels 0, 1 and 6.
  166. .fi
  167. Remove all links for a script (assuming foobar has been deleted
  168. already):
  169. .nf
  170. .B " update\-rc.d foobar remove"
  171. .fi
  172. Example of disabling a service:
  173. .nf
  174. .B " update\-rc.d foobar disable"
  175. .fi
  176. Example of a command for installing a system initialization\-and\-shutdown script:
  177. .nf
  178. .B " update\-rc.d foobar defaults"
  179. .fi
  180. Example of a command for disabling a system initialization\-and\-shutdown script:
  181. .nf
  182. .B " update\-rc.d foobar disable"
  183. .fi
  184. .SH "BUGS"
  185. See http://bugs.debian.org/sysv\-rc.
  186. .SH "FILES"
  187. .TP
  188. .B /etc/init.d/
  189. The directory containing the actual init scripts.
  190. .TP
  191. .B /etc/rc?.d/
  192. The directories containing the links used by
  193. .BR init
  194. and managed by
  195. .BR update\-rc.d .
  196. .TP
  197. .B /etc/init.d/skeleton
  198. Model for use by writers of
  199. .B init.d
  200. scripts.
  201. .SH "SEE ALSO"
  202. .IR "Debian Policy Manual" ,
  203. .br
  204. .BR /etc/init.d/skeleton ,
  205. .br
  206. .BR insserv (8),
  207. .BR sysv\-rc\-conf (8),
  208. .BR bum (8),
  209. .BR init (8).