{"id":704,"date":"2016-11-04T17:43:50","date_gmt":"2016-11-05T02:43:50","guid":{"rendered":"\/blog\/?p=704"},"modified":"2023-09-21T09:37:54","modified_gmt":"2023-09-21T00:37:54","slug":"system-v-init-scripts-for-red-hat-linux","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=704","title":{"rendered":"System V init scripts for Red Hat Linux"},"content":{"rendered":"\n<p><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\ucd9c\ucc98 :&nbsp;<\/span><a href=\"http:\/\/www.sensi.org\/~alec\/unix\/redhat\/sysvinit.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">http:\/\/www.sensi.org\/~alec\/unix\/redhat\/sysvinit.html<\/span><\/a><\/p>\r\n<pre style=\"color: rgb(209, 209, 209); background: rgb(0, 0, 0);\"><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\">#!<\/span><span style=\"color: rgb(0, 121, 151); font-family: &quot;Courier New&quot;, Courier, monospace;\">\/bin\/bash<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\">#<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\"># \/etc\/rc.d\/init.d\/&lt;servicename&gt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\">#<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\"># &lt;description of the *service*&gt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\"># &lt;any general comments about this init script&gt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\">#<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\"># &lt;tags -- see below for tag definitions. *Every line* from the top<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\"># of the file to the end of the tags section must begin with a #<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\"># character. After the tags section, there should be a blank line.<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\"># This keeps normal comments in the rest of the file from being<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\"># mistaken for tags, should they happen to fit the pattern.&gt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n\r\n<\/span><span style=\"color: rgb(153, 153, 169); font-family: &quot;Courier New&quot;, Courier, monospace;\"># Source function library.<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(230, 97, 112); font-weight: bold; font-family: &quot;Courier New&quot;, Courier, monospace;\">.<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(64, 1, 90); font-family: &quot;Courier New&quot;, Courier, monospace;\">\/etc\/rc.d\/init.d\/functions<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n\r\n<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\"># &lt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">define any <\/span><span style=\"color: rgb(144, 64, 80); font-family: &quot;Courier New&quot;, Courier, monospace;\">local<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> shell functions used by the code that follows<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">&gt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n\r\n<\/span><span style=\"color: rgb(230, 97, 112); font-weight: bold; font-family: &quot;Courier New&quot;, Courier, monospace;\">case<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(0, 196, 196); font-family: &quot;Courier New&quot;, Courier, monospace;\">\"<\/span><span style=\"color: rgb(0, 196, 196); font-family: &quot;Courier New&quot;, Courier, monospace;\">$1<\/span><span style=\"color: rgb(0, 196, 196); font-family: &quot;Courier New&quot;, Courier, monospace;\">\"<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(230, 97, 112); font-weight: bold; font-family: &quot;Courier New&quot;, Courier, monospace;\">in<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n    start<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">)<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n        <\/span><span style=\"color: rgb(144, 64, 80); font-family: &quot;Courier New&quot;, Courier, monospace;\">echo<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(0, 221, 221); font-family: &quot;Courier New&quot;, Courier, monospace;\">-n<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(0, 196, 196); font-family: &quot;Courier New&quot;, Courier, monospace;\">\"Starting &lt;servicename&gt; services: \"<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n        <\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">&lt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">start daemons, perhaps with the daemon <\/span><span style=\"color: rgb(230, 97, 112); font-weight: bold; font-family: &quot;Courier New&quot;, Courier, monospace;\">function<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">&gt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n        touch <\/span><span style=\"color: rgb(64, 1, 90); font-family: &quot;Courier New&quot;, Courier, monospace;\">\/var\/lock\/subsys<\/span><span style=\"color: rgb(64, 1, 90); font-family: &quot;Courier New&quot;, Courier, monospace;\">\/<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">&lt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">servicename<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">&gt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n    <\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">;;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n    stop<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">)<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n        <\/span><span style=\"color: rgb(144, 64, 80); font-family: &quot;Courier New&quot;, Courier, monospace;\">echo<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(0, 221, 221); font-family: &quot;Courier New&quot;, Courier, monospace;\">-n<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(0, 196, 196); font-family: &quot;Courier New&quot;, Courier, monospace;\">\"Shutting down &lt;servicename&gt; services: \"<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n        <\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">&lt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">stop daemons, perhaps with the killproc <\/span><span style=\"color: rgb(230, 97, 112); font-weight: bold; font-family: &quot;Courier New&quot;, Courier, monospace;\">function<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">&gt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n        rm <\/span><span style=\"color: rgb(0, 221, 221); font-family: &quot;Courier New&quot;, Courier, monospace;\">-f<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(64, 1, 90); font-family: &quot;Courier New&quot;, Courier, monospace;\">\/var\/lock\/subsys<\/span><span style=\"color: rgb(64, 1, 90); font-family: &quot;Courier New&quot;, Courier, monospace;\">\/<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">&lt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">servicename<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">&gt;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n    <\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">;;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n    restart<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">)<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n        $0 stop\r\n        $0 start\r\n    <\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">;;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n    <\/span><span style=\"color: rgb(210, 205, 134); font-family: &quot;Courier New&quot;, Courier, monospace;\">*<\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">)<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n        <\/span><span style=\"color: rgb(144, 64, 80); font-family: &quot;Courier New&quot;, Courier, monospace;\">echo<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(0, 196, 196); font-family: &quot;Courier New&quot;, Courier, monospace;\">\"Usage: &lt;servicename&gt; {start|stop|restart}\"<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n        <\/span><span style=\"color: rgb(144, 64, 80); font-family: &quot;Courier New&quot;, Courier, monospace;\">exit<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\"> <\/span><span style=\"color: rgb(0, 140, 0); font-family: &quot;Courier New&quot;, Courier, monospace;\">1<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n    <\/span><span style=\"color: rgb(227, 74, 220); font-family: &quot;Courier New&quot;, Courier, monospace;\">;;<\/span><span style=\"font-family: &quot;Courier New&quot;, Courier, monospace;\">\r\n<\/span><span style=\"color: rgb(230, 97, 112); font-weight: bold; font-family: &quot;Courier New&quot;, Courier, monospace;\">esac<\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\ucd9c\ucc98 :&nbsp;http:\/\/www.sensi.org\/~alec\/unix\/redhat\/sysvinit.html #!\/bin\/bash # # \/etc\/rc.d\/init.d\/&lt;servicename&gt; # # &lt;description of the *service*&gt; # &lt;any general comments about this init script&gt; # # &lt;tags &#8212; see below for tag definitions. *Every line* from the top # of the file to the end of the tags section must begin with a # # character. After the tags [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[39],"tags":[],"class_list":["post-704","post","type-post","status-publish","format-standard","hentry","category-os_linux_unix_macos"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=704"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/704\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}