{"id":176072,"date":"2020-04-21T11:49:17","date_gmt":"2020-04-21T03:49:17","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=176072"},"modified":"2020-04-09T09:25:55","modified_gmt":"2020-04-09T01:25:55","slug":"centos-system-v-init","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos-system-v-init.html","title":{"rendered":"CentOS\u7684System V init\u542f\u52a8\u811a\u672c"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | CentOS\u7cfb\u7edf\u672c\u8eab\u81ea\u5e26\u4e86\u8bf4\u660e\uff0c\u5728\/usr\/share\/doc\/initscripts-(*)\/sysvinitfiles\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a\u6240\u6709System V init\u811a\u672c\u90fd\u547d\u540d\u4e3a\/etc\/rc.d\/init.d\/<servicename>\uff0c\u5176\u4e2d<\/servicename><servicename>\u662f\u670d\u52a1\u7684\u540d\u79f0\u3002\u5fc5\u987b\u6ca1\u6709\u201c.init\u201d\u540e\u7f00\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n \u793a\u4f8b\u811a\u672c\uff1a<\/p>\n \r\n#!\/bin\/bash\r\n#\r\n# \/etc\/rc.d\/init.d\/<servicename>\r\n#\r\n# <description of the *service*>\r\n# <any general comments about this init script>\r\n#\r\n# <tags -- see below for tag definitions. *Every line* from the top\r\n# of the file to the end of the tags section must begin with a #\r\n# character. After the tags section, there should be a blank line.\r\n# This keeps normal comments in the rest of the file from being\r\n# mistaken for tags, should they happen to fit the pattern.>\r\n\r\n# Source function library.\r\n. \/etc\/rc.d\/init.d\/functions\r\n\r\n<define any local shell functions used by the code that follows>\r\n\r\ncase \"$1\" in\r\n start)\r\n echo -n \"Starting <servicename> services: \"\r\n <start daemons, perhaps with the daemon function>\r\n touch \/var\/lock\/subsys\/<servicename>\r\n ;;\r\n stop)\r\n echo -n \"Shutting down <servicename> services: \"\r\n <stop daemons, perhaps with the killproc function>\r\n rm -f \/var\/lock\/subsys\/<servicename>\r\n ;;\r\n status)\r\n <report the status of the daemons in free-form format,\r\n perhaps with the status function>\r\n ;;\r\n restart)\r\n <restart the daemons, normally with $0 stop; $0 start>\r\n ;;\r\n reload)\r\n <cause the service configuration to be reread, either with\r\n kill -HUP or by restarting the daemons, possibly with\r\n $0 stop; $0 start>\r\n ;;\r\n probe)\r\n <optional. If it exists, then it should determine whether\r\n or not the service needs to be restarted or reloaded (or\r\n whatever) in order to activate any changes in the configuration\r\n scripts. It should print out a list of commands to give to\r\n $0; see the description under the probe tag below.>\r\n ;;\r\n *)\r\n echo \"Usage: <servicename> {start|stop|status|reload|restart[|probe]\"\r\n exit 1\r\n ;;\r\nesac\r\n<\/pre>\n |