{"id":923,"date":"2022-12-21T23:28:38","date_gmt":"2022-12-21T15:28:38","guid":{"rendered":"https:\/\/program.snlcw.com\/?p=923"},"modified":"2022-12-25T22:00:27","modified_gmt":"2022-12-25T14:00:27","slug":"%e5%88%9b%e5%bb%ba-systemctl-%e8%87%aa%e5%90%af%e5%8a%a8%e4%bb%bb%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/program.snlcw.com\/923.html","title":{"rendered":"\u521b\u5efa systemctl \u81ea\u542f\u52a8\u4efb\u52a1"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/program.snlcw.com\/923.html\/#1_%E5%88%9B%E5%BB%BA_Service\" >1. \u521b\u5efa Service<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/program.snlcw.com\/923.html\/#2_%E5%88%A0%E9%99%A4_Service\" >2. \u5220\u9664 Service<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_%E5%88%9B%E5%BB%BA_Service\"><\/span>1. \u521b\u5efa Service<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">\/lib\/systemd\/system<\/mark> \u76ee\u5f55\u4e0b\u521b\u5efa tomcat.service \u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[Unit]\nDescription=Tomcat service.\n\n[Service]\nType=forking\nExecStart=\/home\/startup.sh\nExecReload=\/bin\/kill -SIGHUP $MAINPID\nExecStop=\/home\/shutdown.sh\n\n[Install]\nWantedBy=multi-user.target graphical.target<\/pre>\n\n\n\n<p>tomcat.service \u6838\u5fc3\u5c31\u662f startup.sh\u3001shutdown.sh \u811a\u672c\uff0c\u6dfb\u52a0\u5b8c\u540e\u9700\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u3001\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\u52a8\u7b49\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u8bbe\u7f6e\u53ef\u6267\u884c\u6743\u9650\nsudo chmod +x .\/startup.sh\nsudo chmod +x .\/shutdown.sh\n\n# \u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\nsudo systemctl daemon-reload\n\n# \u542f\u52a8\u670d\u52a1\nsystemctl start tpqxb.service\n\n# \u670d\u52a1\u5e38\u7528\u64cd\u4f5c\uff08\u5f53\u7136\u914d\u7f6e\u91cc\u9700\u8981\u652f\u6301\u624d\u884c\uff09\nsystemctl start tomcat.service\nsystemctl stop tomcat.service\nsystemctl restart tomcat.service\nsystemctl status tomcat.service\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_%E5%88%A0%E9%99%A4_Service\"><\/span>2. \u5220\u9664 Service<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl stop [servicename]\nsystemctl disable [servicename]\nrm \/etc\/systemd\/system\/[servicename]\nrm \/etc\/systemd\/system\/[servicename] # and symlinks that might be related\nrm \/usr\/lib\/systemd\/system\/[servicename] \nrm \/usr\/lib\/systemd\/system\/[servicename] # and symlinks that might be related\nsystemctl daemon-reload\nsystemctl reset-failed<\/pre>\n\n\n\n<p>It is possible that the systemd service &#8216;wraps&#8217; the old style scripts in <code>\/etc\/init.d<\/code>, so you may want to clean that up too, but that is\u00a0<em>not<\/em>\u00a0where systemd services live.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u521b\u5efa Service \/lib\/systemd\/system \u76ee\u5f55\u4e0b\u521b\u5efa tomcat.service \u2026 <span class=\"read-more\"><a href=\"https:\/\/program.snlcw.com\/923.html\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"class_list":["post-923","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/posts\/923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/comments?post=923"}],"version-history":[{"count":0,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/posts\/923\/revisions"}],"wp:attachment":[{"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/media?parent=923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/categories?post=923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/tags?post=923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}