{"id":3018,"date":"2025-10-21T09:45:06","date_gmt":"2025-10-21T00:45:06","guid":{"rendered":"https:\/\/blog.id774.net\/entry\/?p=3018"},"modified":"2025-10-27T00:34:29","modified_gmt":"2025-10-26T15:34:29","slug":"ntp-%e3%82%b5%e3%83%bc%e3%83%93%e3%82%b9%e5%86%8d%e8%b5%b7%e5%8b%95%e3%83%9d%e3%83%aa%e3%82%b7%e3%83%bc%e3%82%92%e8%a8%ad%e5%ae%9a%e3%81%97%e3%81%9f","status":"publish","type":"post","link":"https:\/\/blog.id774.net\/entry\/2025\/10\/21\/3018\/","title":{"rendered":"NTP \u30b5\u30fc\u30d3\u30b9\u518d\u8d77\u52d5\u30dd\u30ea\u30b7\u30fc\u3092\u8a2d\u5b9a\u3057\u305f"},"content":{"rendered":"<p>\u4eca\u671d\u3001\u69d8\u3005\u306a\u74b0\u5883\uff08\u7269\u7406\uff0f\u4eee\u60f3\uff0f\u30af\u30e9\u30a6\u30c9\u3001Debian,Ubuntu \u306e\u4e16\u4ee3\u3082\u30d0\u30e9\u30d0\u30e9\uff09\u3067 <strong><a href=\"https:\/\/blog.id774.net\/entry\/2025\/09\/12\/3001\/\">NTP \u30b5\u30fc\u30d3\u30b9<\/a>\u304c\u4e00\u6589\u306b\u6b62\u307e\u3063\u3066\u3044\u305f<\/strong>\u3002\u500b\u5225\u306e\u4e8b\u8c61\u3068\u3044\u3046\u3088\u308a\u5171\u901a\u8981\u56e0\u304c\u3042\u308b\u3068\u5224\u65ad\u3057\u3001\u8abf\u67fb\u3057\u3066\u5bfe\u5fdc\u3057\u305f\u3002<\/p>\n<hr>\n<h2>\u4e8b\u8c61<\/h2>\n<ul>\n<li>\u3044\u304f\u3064\u304b\u306e\u30db\u30b9\u30c8\u3067 ntp, ntpsec, <a href=\"https:\/\/blog.id774.net\/entry\/2025\/09\/07\/2991\/\">myntp<\/a> \u304c <strong>inactive<\/strong> \u306b\u306a\u3063\u3066\u3044\u305f\u3002<\/li>\n<li>\u624b\u52d5\u3067 systemctl restart \u3059\u308c\u3070\u5fa9\u5e30\u3059\u308b\u3002<\/li>\n<li>\u30ed\u30b0\u306b\u306f <strong>signal 15 (Terminated)<\/strong> \u304c\u4e26\u3076\u3002\u3064\u307e\u308a\u30af\u30e9\u30c3\u30b7\u30e5\u3067\u306f\u306a\u304f\u6b62\u3081\u3089\u308c\u305f\u3002<\/li>\n<\/ul>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">ERR: ntpd exiting on signal 15 (Terminated)<br \/>\nsystemd[1]: Stopping ntpsec.service - Network Time Service...<br \/>\nsystemd[1]: ntpsec.service: Deactivated successfully.<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<hr>\n<h2>\u8abf\u67fb\u306e\u6d41\u308c<\/h2>\n<ul>\n<li>journalctl -u ntp* \u3092\u3056\u3063\u3068\u898b\u308b\u3068\u3001<strong>\u5916\u90e8\u304b\u3089\u306e\u505c\u6b62\u547d\u4ee4<\/strong>\uff08systemd\uff09\u3068\u308f\u304b\u308b\u3002<\/li>\n<li>systemctl list-units &#8211;type=service | grep ntp \u3067\u52d5\u4f5c\u4e2d\u30e6\u30cb\u30c3\u30c8\u3092\u78ba\u8a8d\u3002\u591a\u304f\u306e\u30db\u30b9\u30c8\u3067 <strong>NTP \u306e\u81ea\u52d5\u5fa9\u65e7\u8a2d\u5b9a\u304c\u7121\u3044<\/strong>\u3053\u3068\u3082\u5224\u660e\u3002<\/li>\n<li>Debian \u306e\u30e6\u30cb\u30c3\u30c8\u5b9a\u7fa9\uff08\/lib\/systemd\/system\/ntp*.service\uff09\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001Restart= \u6307\u5b9a\u306a\u3057\u3002\u2192 <strong>\u6b62\u307e\u3063\u305f\u3089\u305d\u306e\u307e\u307e<\/strong>\u3001\u3068\u3044\u3046\u8a2d\u8a08\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u5bfe\u5fdc\u6848\u306e\u6bd4\u8f03\uff08\u3056\u3063\u304f\u308a\uff09<\/h2>\n<ul>\n<li>cron \u3067\u5b9a\u671f restart\uff1a\u9045\u3044\u30fb\u96d1\u30fb\u539f\u56e0\u96a0\u3059\u3002<\/li>\n<li>Restart=always\uff1a\u624b\u52d5 stop \u3067\u3082\u8d77\u304d\u76f4\u3059\u3002\u904b\u7528\u304c\u3064\u3089\u3044\u3002<\/li>\n<li><strong>Restart=on-failure + RestartSec=30<\/strong>\uff1a\u7570\u5e38\u7d42\u4e86\u3060\u3051\u81ea\u52d5\u5fa9\u65e7\u3001\u624b\u52d5\u306f\u5c0a\u91cd\u3059\u308b\u3002\u3053\u3061\u3089\u3092\u63a1\u7528\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u65b9\u91dd<\/h2>\n<p><strong>Restart=on-failure \u3092 drop-in \u3067\u5168\u74b0\u5883\u3078<\/strong>\u3002\u5b9f\u88c5\u306e\u9055\u3044\uff08ntp \/ ntpsec \/ myntp\uff09\u306f\u30b9\u30af\u30ea\u30d7\u30c8\u5074\u3067\u691c\u51fa\u3057\u3066\u5438\u53ce\u3059\u308b\u3002<\/p>\n<hr>\n<h2>\u5b9f\u88c5\uff08\u51aa\u7b49\u30fb\u6700\u5c0f\uff09<\/h2>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8 <a href=\"https:\/\/github.com\/id774\/scripts\/blob\/master\/installer\/setup_ntp_restart_policy.sh\">setup_ntp_restart_policy.sh<\/a> \u3092\u4f5c\u6210\u3057\u5bfe\u5fdc\u3057\u305f\u3002\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3001\u5b58\u5728\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u3060\u3051\u306b drop-in \u3092\u7f6e\u304f\u3002<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\"># \/etc\/systemd\/system\/&lt;svc&gt;.service.d\/restart.conf<br \/>\n[Service]<br \/>\nRestart=on-failure<br \/>\nRestartSec=30<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u9069\u7528\u624b\u9806\uff08\u5185\u90e8\u3067\u5b9f\u65bd\uff09:<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">sudo mkdir -p \/etc\/systemd\/system\/&lt;svc&gt;.service.d<br \/>\nsudo tee \/etc\/systemd\/system\/&lt;svc&gt;.service.d\/restart.conf &gt;\/dev\/null &lt;&lt;'EOF'<br \/>\n[Service]<br \/>\nRestart=on-failure<br \/>\nRestartSec=30<br \/>\nEOF<br \/>\n<br \/>\nsudo systemctl daemon-reload<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u9069\u7528\u5f8c\u306e\u78ba\u8a8d:<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">systemctl show &lt;svc&gt; | grep -E 'Restart|RestartSec'<br \/>\n# Restart=on-failure \/ RestartUSec=30s \u304c\u898b\u3048\u308c\u3070 OK<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<hr>\n<h2>\u30c6\u30b9\u30c8\u65b9\u6cd5<\/h2>\n<p><strong>\u7570\u5e38\u7d42\u4e86\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3<\/strong>\uff08\u6b63\u5e38 stop \u3060\u3068\u518d\u8d77\u52d5\u3057\u306a\u3044\u306e\u3067\u6ce8\u610f\uff09:<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">sudo kill -9 $(pidof ntpd) &nbsp; # \u307e\u305f\u306f sudo pkill -9 ntpd<br \/>\nsudo journalctl -u &lt;svc&gt; -f &nbsp; # 30\u79d2\u5f8c\u306e\u518d\u8d77\u52d5\u30ed\u30b0\u3092\u8ffd\u3046<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u671f\u5f85\u30ed\u30b0:<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">... Main process exited, code=killed, status=9\/KILL<br \/>\n... Scheduled restart job, restart counter is 1.<br \/>\n... Started Network Time Service.<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u72b6\u614b\u78ba\u8a8d:<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">systemctl status &lt;svc&gt; # active (running)<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p class=\"small\">\u88dc\u8db3\uff1a\u9023\u7d9a\u5931\u6557\u6642\u306f <a href=\"https:\/\/wiki.archlinux.org\/title\/Systemd\">start-limit-hit<\/a> \u3067\u81ea\u52d5\u518d\u8a66\u884c\u304c\u6b62\u307e\u308b\u3002\u5fa9\u65e7\u306f sudo systemctl reset-failed &lt;svc&gt;; sudo systemctl start &lt;svc&gt;\u3002<\/p>\n<hr>\n<h2>\u958b\u767a\u74b0\u5883\u3067\u306e\u691c\u8a3c<\/h2>\n<ul>\n<li>ntpsec \u7a3c\u50cd\u30db\u30b9\u30c8\uff1adrop-in \u914d\u7f6e \u2192 kill \u2192 <strong>30\u79d2\u5f8c\u306b\u81ea\u52d5\u5fa9\u5e30<\/strong>\u3092\u78ba\u8a8d\u3002<\/li>\n<li>ntp \u7a3c\u50cd\u30db\u30b9\u30c8\uff1a\u540c\u69d8\u306b\u78ba\u8a8d\u3002ntp-wait.service \u306f\u8d77\u52d5\u6642\u306e\u30ef\u30f3\u30b7\u30e7\u30c3\u30c8\u3067\u554f\u984c\u306a\u3057\u3002<\/li>\n<li>\u30b5\u30fc\u30d3\u30b9\u7af6\u5408\u306a\u3057\uff08\u7247\u65b9\u306e\u307f active\uff09\u3002systemctl list-units &#8211;type=service | grep ntp \u3067\u8996\u8a8d\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u5f97\u3089\u308c\u305f\u77e5\u898b<\/h2>\n<ul>\n<li>\u505c\u6b62\u306e\u30c8\u30ea\u30ac\u30fc\u304c\u4f55\u3067\u3042\u308c\u3001<strong>\u30b5\u30fc\u30d3\u30b9\u306b\u81ea\u5f8b\u56de\u5fa9\u529b\u3092\u6301\u305f\u305b\u308b<\/strong>\u306e\u304c\u52b9\u304f\u3002<\/li>\n<li><strong>drop-in \u3067\u5c0f\u3055\u304f\u59cb\u3081\u308b<\/strong>\u306e\u304c\u65e9\u3044\u30fb\u58ca\u308c\u306a\u3044\u30fb\u30d1\u30c3\u30b1\u30fc\u30b8\u66f4\u65b0\u306b\u3082\u5f37\u3044\u3002<\/li>\n<li>\u76e3\u8996\u3068\u30ed\u30b0\u306f\u5f15\u304d\u7d9a\u304d\u5927\u4e8b\uff08\u518d\u8d77\u52d5\u30eb\u30fc\u30d7\u306f\u691c\u77e5\u3057\u3066\u6b62\u3081\u308b\u3001start-limit-hit \u306b\u6ce8\u610f\uff09\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u78ba\u8a8d<\/h2>\n<p>\u6700\u5f8c\u306b\u72b6\u614b\u3092\u5fc5\u305a\u898b\u3066\u304a\u304f\u3002<\/p>\n<div class=\"codecolorer-container text geshi\" style=\"overflow:auto;white-space:nowrap;width:1000px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\" style=\"white-space:nowrap\">systemctl list-units --type=service | grep ntp || echo &quot;No NTP services are active.&quot;<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>\u518d\u767a\u9632\u6b62\u3068\u3057\u3066\u306e\u52b9\u679c\u306f\u5927\u304d\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u671d\u3001\u69d8\u3005\u306a\u74b0\u5883\uff08\u7269\u7406\uff0f\u4eee\u60f3\uff0f\u30af\u30e9\u30a6\u30c9\u3001Debian,Ubuntu \u306e\u4e16\u4ee3\u3082\u30d0\u30e9\u30d0\u30e9\uff09\u3067 NTP \u30b5\u30fc\u30d3\u30b9\u304c\u4e00\u6589\u306b\u6b62\u307e\u3063\u3066\u3044\u305f\u3002\u500b\u5225\u306e\u4e8b\u8c61\u3068\u3044\u3046\u3088\u308a\u5171\u901a\u8981\u56e0\u304c\u3042\u308b\u3068\u5224\u65ad\u3057\u3001\u8abf\u67fb\u3057\u3066\u5bfe\u5fdc\u3057\u305f\u3002 \u4e8b\u8c61 \u3044\u304f\u3064\u304b\u306e\u30db\u30b9\u30c8\u3067 n &#8230; <a title=\"NTP \u30b5\u30fc\u30d3\u30b9\u518d\u8d77\u52d5\u30dd\u30ea\u30b7\u30fc\u3092\u8a2d\u5b9a\u3057\u305f\" class=\"read-more\" href=\"https:\/\/blog.id774.net\/entry\/2025\/10\/21\/3018\/\" aria-label=\"NTP \u30b5\u30fc\u30d3\u30b9\u518d\u8d77\u52d5\u30dd\u30ea\u30b7\u30fc\u3092\u8a2d\u5b9a\u3057\u305f \u306b\u3064\u3044\u3066\u3055\u3089\u306b\u8aad\u3080\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,14],"tags":[],"class_list":["post-3018","post","type-post","status-publish","format-standard","hentry","category-diary","category-tech"],"_links":{"self":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts\/3018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/comments?post=3018"}],"version-history":[{"count":0,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts\/3018\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/media?parent=3018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/categories?post=3018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/tags?post=3018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}