{"id":307,"date":"2025-07-04T04:41:49","date_gmt":"2025-07-04T04:41:49","guid":{"rendered":"https:\/\/blog.chaiyakul.com\/?p=307"},"modified":"2025-07-04T04:41:49","modified_gmt":"2025-07-04T04:41:49","slug":"auto-service-reboot-centos-9","status":"publish","type":"post","link":"https:\/\/blog.chaiyakul.com\/index.php\/2025\/07\/04\/auto-service-reboot-centos-9\/","title":{"rendered":"\u0e01\u0e32\u0e23\u0e15\u0e31\u0e49\u0e07 Service \u0e23\u0e31\u0e19\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07 Reboot \u0e1a\u0e19 CentOS 9"},"content":{"rendered":"\n<p>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e2a\u0e21\u0e21\u0e38\u0e15\u0e34: \u0e2a\u0e23\u0e49\u0e32\u0e07 Service \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e23\u0e31\u0e19 Script<\/p>\n\n\n\n<p>\u0e40\u0e0a\u0e48\u0e19 \u0e21\u0e35\u0e44\u0e1f\u0e25\u0e4c <code>\/home\/mill\/run_webviewer.sh<\/code> \u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e43\u0e2b\u0e49\u0e23\u0e31\u0e19\u0e17\u0e38\u0e01\u0e04\u0e23\u0e31\u0e49\u0e07\u0e2b\u0e25\u0e31\u0e07\u0e1a\u0e39\u0e15<\/p>\n\n\n\n<p>\u0e02\u0e31\u0e49\u0e19\u0e15\u0e2d\u0e19<\/p>\n\n\n\n<p>1.\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c Service<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo nano \/etc\/systemd\/system\/webviewer.service\n<\/pre><\/div>\n\n\n<p>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e40\u0e19\u0e37\u0e49\u0e2d\u0e2b\u0e32\u0e44\u0e1f\u0e25\u0e4c<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;Unit]\nDescription=Web Viewer Autostart\nAfter=network.target\n\n&#x5B;Service]\nType=simple\nExecStart=\/home\/mill\/run_webviewer.sh\nRestart=always\nUser=mill\n\n&#x5B;Install]\nWantedBy=multi-user.target\n<\/pre><\/div>\n\n\n<p>\u0e04\u0e33\u0e2d\u0e18\u0e34\u0e1a\u0e32\u0e22<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>After=network.target<\/code> : \u0e23\u0e2d\u0e43\u0e2b\u0e49\u0e23\u0e30\u0e1a\u0e1a Network \u0e1e\u0e23\u0e49\u0e2d\u0e21\u0e01\u0e48\u0e2d\u0e19<\/li>\n\n\n\n<li><code>User=mill<\/code> : \u0e23\u0e31\u0e19\u0e43\u0e19\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c\u0e02\u0e2d\u0e07\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49 mill<\/li>\n\n\n\n<li><code>Restart=always<\/code> : \u0e43\u0e2b\u0e49 Restart \u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e32\u0e01\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e2b\u0e22\u0e38\u0e14\u0e17\u0e33\u0e07\u0e32\u0e19<\/li>\n\n\n\n<li><code>WantedBy=multi-user.target<\/code> : \u0e23\u0e31\u0e19\u0e43\u0e19\u0e42\u0e2b\u0e21\u0e14\u0e1b\u0e01\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07\u0e1a\u0e39\u0e15<\/li>\n<\/ul>\n\n\n\n<p>2.\u0e43\u0e2b\u0e49\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c\u0e01\u0e31\u0e1a Script<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nchmod +x \/home\/mill\/run_webviewer.sh\n<\/pre><\/div>\n\n\n<p>3.\u0e42\u0e2b\u0e25\u0e14 Service \u0e40\u0e02\u0e49\u0e32 systemd<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo systemctl daemon-reload\n<\/pre><\/div>\n\n\n<p>4.\u0e40\u0e1b\u0e34\u0e14\u0e43\u0e2b\u0e49 Service \u0e17\u0e33\u0e07\u0e32\u0e19\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07 Reboot<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo systemctl enable webviewer.service\n<\/pre><\/div>\n\n\n<p>5.\u0e40\u0e23\u0e34\u0e48\u0e21\u0e23\u0e31\u0e19 Service \u0e17\u0e31\u0e19\u0e17\u0e35 (\u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07 reboot)<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo systemctl start webviewer.service\n<\/pre><\/div>\n\n\n<p>6.\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e2a\u0e16\u0e32\u0e19\u0e30<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo systemctl status webviewer.service\n<\/pre><\/div>\n\n\n<p>\u0e2b\u0e32\u0e01\u0e44\u0e21\u0e48\u0e21\u0e35 Error \u0e41\u0e2a\u0e14\u0e07\u0e27\u0e48\u0e32\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32\u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08<\/p>\n\n\n\n<p>\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0e16\u0e49\u0e32\u0e40\u0e1b\u0e47\u0e19\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21 GUI \u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e23\u0e31\u0e19\u0e43\u0e19 Desktop Session \u0e15\u0e49\u0e2d\u0e07\u0e43\u0e0a\u0e49\u0e27\u0e34\u0e18\u0e35\u0e2d\u0e37\u0e48\u0e19 \u0e40\u0e0a\u0e48\u0e19 <code>.desktop<\/code> \u0e17\u0e35\u0e48 <code>~\/.config\/autostart\/<\/code><\/li>\n\n\n\n<li>\u0e27\u0e34\u0e18\u0e35\u0e19\u0e35\u0e49\u0e40\u0e2b\u0e21\u0e32\u0e30\u0e01\u0e31\u0e1a\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21 Server \u0e2b\u0e23\u0e37\u0e2d Script \u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e21\u0e35 GUI \u0e40\u0e0a\u0e48\u0e19 Web Server, Python Script, Shell Script \u0e2f\u0e25\u0e2f<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e2a\u0e21\u0e21\u0e38\u0e15\u0e34: \u0e2a\u0e23\u0e49\u0e32\u0e07 Service \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e23\u0e31\u0e19 Script \u0e40\u0e0a\u0e48\u0e19 \u0e21\u0e35\u0e44 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","footnotes":""},"categories":[105,9,160],"tags":[],"class_list":["post-307","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","category-service"],"_links":{"self":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/comments?post=307"}],"version-history":[{"count":1,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/307\/revisions"}],"predecessor-version":[{"id":308,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/307\/revisions\/308"}],"wp:attachment":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/media?parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/categories?post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/tags?post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}