{"id":4082,"date":"2021-02-11T11:58:09","date_gmt":"2021-02-11T02:58:09","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=4082"},"modified":"2023-06-22T05:20:22","modified_gmt":"2023-06-21T20:20:22","slug":"systemd%e3%81%aesevice%e3%81%aeunit%e3%82%92%e4%bd%9c%e6%88%90%e3%81%99%e3%82%8b%ef%bc%81","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/4082","title":{"rendered":"Systemd\u3067\u72ec\u81ea\u306eService\u306eUnit\u3092\u4f5c\u6210\u3059\u308b\uff01"},"content":{"rendered":"<p>Systemd\u306eService\u306eUnit\u3092\u4f5c\u6210\u3057\u3001Systemd\u3067\u5236\u5fa1\u53ef\u80fd\u306b\u3057\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>Service\u7528\u306eUnit\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>\u300cetc\/systemd\/system\u300d\u306bUnit\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001Db2\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u8d77\u52d5\u3059\u308b\u4f8b\u306b\u306a\u308a\u307e\u3059\u3002Db2\u306f\u3001systemd\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u901a\u5e38\u306fsystemd\u3088\u308a\u81ea\u52d5\u8d77\u52d5\u3057\u307e\u3059\u304c\u3001Db2\u306e\u8a2d\u5b9a\u3067\u81ea\u52d5\u8d77\u52d5\u3092\u505c\u6b62\u3057\u3066\u3001\u8907\u6570\u30a4\u30f3\u30b9\u30bf\u30f3\u3092\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5225\u306bsystemd\u306b\u767b\u9332\u3057\u3066\u7ba1\u7406\u3059\u308b\u3053\u3068\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\u30b7\u30a7\u30eb\u3088\u308a\u3001\u88fd\u54c1\u7cfb\u306e\u5e38\u6642\u8d77\u52d5\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u8d77\u52d5\u3059\u308b\u5834\u5408\u306f\u3001Type=oneshot\u3067\u3001RemainAfterExit=yes\u3092\u4f7f\u7528\u3059\u308b\u3068\u3088\u3044\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1]; title: ; notranslate\" title=\"\">\r\nvi \/etc\/systemd\/system\/db2inst1.service\r\n&#x5B;Unit]\r\nDescription=Db2 Instance - db2inst1\r\n\r\n&#x5B;Service]\r\nType=oneshot\r\nRemainAfterExit=yes\r\nUser=db2inst1\r\nExecStart=\/home\/ubuusr01\/bin\/start_db2inst1.sh\r\nExecStop=\/home\/ubuusr01\/bin\/stop_db2inst1.sh\r\n\r\n&#x5B;Install]\r\nWantedBy=multi-user.target\r\n<\/pre>\n<h2>Service\u7528\u306eUnit\u30d5\u30a1\u30a4\u30eb\u3092\u8a8d\u8b58\u3055\u305b\u308b\uff01<\/h2>\n<p>\u518d\u8d77\u52d5\u3057\u3066\u3082\u3088\u3044\u3067\u3059\u304c\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u518d\u8d77\u52d5\u305b\u305a\u306bsystemd\u306b\u65b0\u898f\u306b\u4f5c\u6210\u3057\u305fUnit\u3092\u8a8d\u8b58\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,2]; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl daemon-reload\r\n$ sudo systemctl list-unit-files | grep db2inst1\r\ndb2inst1.service                           disabled  \r\n<\/pre>\n<h2>Service\u3092\u306e\u8d77\u52d5\u3068\u505c\u6b62\u3092\u884c\u3046\uff01<\/h2>\n<p>Service\u306e\u8d77\u52d5\u3068\u505c\u6b62\u3092\u884c\u3044\u307e\u3059\u3002restart\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u3066\u518d\u8d77\u52d5\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,2,3,4,5]; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl status db2inst1\r\n$ sudo systemctl start db2inst1\r\n$ sudo systemctl status db2inst1\r\n$ sudo systemctl stop db2inst1\r\n$ sudo systemctl status db2inst1\r\n<\/pre>\n<h2>Service\u3092\u81ea\u52d5\u8d77\u52d5\u306b\u8a2d\u5b9a\u3059\u308b\uff01<\/h2>\n<p>Service\u3092\u81ea\u52d5\u8d77\u52d5\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; highlight: [1,3]; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl enable db2inst1\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/db2inst1.service \u2192 \/etc\/systemd\/system\/db2inst1.service.\r\n$ sudo systemctl is-enabled db2inst1\r\nenabled\r\n<\/pre>\n<p>\u518d\u8d77\u52d5\u3057\u3066\u3001Service\u304c\u81ea\u52d5\u8d77\u52d5\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>Service\u306eUnit\u3092\u4f5c\u6210\u3057\u3066\u3001multi-user.target\u306b\u767b\u9332\u3057\u307e\u3057\u305f\u3002Systemd\u306b\u767b\u9332\u3059\u308c\u3070\u81ea\u52d5\u8d77\u52d5\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u95a2\u9023\u8a18\u4e8b<\/h2>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/lab4ict.com\/system\/archives\/8621\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"150\" height=\"150\" alt=\"\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Linux\u306e\u8d77\u52d5\u3068\u505c\u6b62\u3092Systemd\u3067\u5236\u5fa1\u3059\u308b\uff01\" loading=\"lazy\" data-src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2021\/02\/fi_linux_01-150x150.png\" class=\"lazyload\"><\/div><div class=\"title\">\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Linux\u306e\u8d77\u52d5\u3068\u505c\u6b62\u3092Systemd\u3067\u5236\u5fa1\u3059\u308b\uff01<\/div><div class=\"substr\">Systemd\u3067Linux\u306e\u8d77\u52d5\u3068\u505c\u6b62\u3092\u5236\u5fa1\u3059\u308b\u305f\u3081\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u63b2\u8f09\u3057\u307e\u3059\u3002...<\/div><\/a><\/div>\n<h2>\u95a2\u9023\u66f8\u7c4d\uff08Amazon\uff09<\/h2>\n<p><a href=\"https:\/\/amzn.to\/48CJTzL\" rel=\"noopener\" target=\"_blank\"><img decoding=\"async\" class=\"paapi5-pa-product-image-source\" src=\"https:\/\/m.media-amazon.com\/images\/I\/41cVV6Rkp2L._SL160_.jpg\" alt=\"N\/A\"><\/a><\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Systemd\u306eService\u306eUnit\u3092\u4f5c\u6210\u3057\u3001Systemd\u3067\u5236\u5fa1\u53ef\u80fd\u306b\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":5527,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[125],"tags":[560,283,561,525,559],"class_list":["post-4082","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-systemd","tag-service","tag-systemd","tag-unit","tag-525","tag-559"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/4082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=4082"}],"version-history":[{"count":1,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/4082\/revisions"}],"predecessor-version":[{"id":12491,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/4082\/revisions\/12491"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/5527"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=4082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=4082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=4082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}