{"id":342241,"date":"2022-12-06T21:00:34","date_gmt":"2022-12-06T21:00:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=342241"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2022-12-06T21:00:34","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=342241","title":{"rendered":"<span>\u0421\u0430\u043c\u0430\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0434\u043b\u044f Linux<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><em>\u0414\u0435\u043b\u0430\u0435\u043c \u0438\u0437 \u043c\u0443\u0445\u0438 \u0441\u043b\u043e\u043d\u0430 \u0438\u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u043f\u0438\u043d\u0433\u0432\u0438\u043d\u0430<\/em><\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f45\/552\/b34\/f45552b34c94fee1e4c0cb74d8cf17b2.png\" width=\"412\" height=\"309\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f45\/552\/b34\/f45552b34c94fee1e4c0cb74d8cf17b2.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u0412\u0432\u0440\u0434\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Gentoo Linux \u043d\u0430 \u0441\u0432\u043e\u0439 \u043d\u0435\u0442\u0431\u0443\u043a \u044f \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0435\u0442 \u0448\u0442\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>sudo.<\/strong><\/p>\n<p><strong>\u0417\u0430\u0449\u0438\u0442\u043d\u043e\u0435 \u0437\u0430\u044f\u043b\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0430<\/strong><\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0435 \u043f\u0440\u0438\u0437\u044b\u0432\u0430\u044e  \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a  \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043c\u043d\u043e\u0439, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438 \u043f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043e. \u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0430\u0432\u0442\u043e\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u043a\u043e\u0434 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445.<\/p>\n<p><strong>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Gentoo Linux \u043d\u0430 \u0441\u0432\u043e\u0439 \u043d\u0435\u0442\u0431\u0443\u043a \u044f \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0435\u0442 \u0448\u0442\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0432\u0440\u043e\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b <strong>sudo,<\/strong> \u0430 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430<br \/><strong>\/etc\/group<\/strong> \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e, \u0447\u0442\u043e \u0432 \u043d\u0451\u043c \u043d\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u044b <strong>operator.<\/strong> \u041b\u044e\u0431\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0443 \u0433\u0440\u0443\u043f\u043f\u0443 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043d\u0435\u0451 \u043d\u0435 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0438 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 &#8212; \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u043b\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/p>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0440\u0430\u0437\u043c\u044b\u0441\u043b\u0438\u0432, \u044f \u043f\u0440\u0438\u0448\u0451\u043b \u043a  \u0438\u0434\u0435\u0438 (\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044f \u043d\u0435 \u0431\u044b\u043b \u043f\u0435\u0440\u0432\u044b\u043c) \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a <strong>cron<\/strong> \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 . \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0439 \u043d\u0430\u0441\u043a\u043e\u0440\u043e \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 <strong>bash<\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0432  cron \u0434\u043b\u044f \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<br \/>\u0421\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u0440\u0430\u0437 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443 \u043e\u0442 <strong>root,<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u0444\u0430\u0439\u043b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432 \u043d\u0451\u043c <strong>\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/strong> \u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u043b  \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0432 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b  <strong>\u043a\u043e\u0434 0<\/strong> \u0434\u043b\u044f \u0431\u0435\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0435 \u043d\u0430\u0447\u0430\u043b \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e. \u042f \u0438 \u0441\u0430\u043c \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 \u0441\u043e\u0437\u0434\u0430\u043b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 (\u0445\u043e\u0442\u044f \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438).  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c \u0444\u043e\u0440\u0443\u043c\u0430 <a href=\"http:\/\/Linux.org.ru\" rel=\"noopener noreferrer nofollow\">Linux.org.ru<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0432\u0440\u0435\u043c\u044f<a href=\"https:\/\/www.linux.org.ru\/forum\/desktop\/17045140?cid=17045842\" rel=\"noopener noreferrer nofollow\"> \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043c\u043d\u0435<\/a> \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 <a href=\"https:\/\/www.linux.org.ru\/forum\/desktop\/17045140?cid=17045842\" rel=\"noopener noreferrer nofollow\">\u0434\u0430\u043b\u0438 \u0440\u044f\u0434 \u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u0432\u0435\u0442\u043e\u0432<\/a> \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043c\u043e\u0435\u0439 \u0441\u043a\u0440\u043e\u043c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<ol>\n<li>\n<p>\u041d\u0430 \u044f\u0437\u044b\u043a\u0435 C \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f 1 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0447\u0435\u0440\u0435\u0437 <strong>\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a cron<\/strong> \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b  <strong>\/run\/shut.txt<\/strong>. \u0414\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u043b\u044f <strong>root<\/strong>  \u0438 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.  \u0425\u043e\u0437\u044f\u0438\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 C, \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430  \u0432 \u0444\u0430\u0439\u043b\u0435  <strong>\/run\/shut.txt.<\/strong><\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f, \u0442\u043e <strong>\u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/strong><\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0434\u0432\u0430 <strong>sh<\/strong> \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b <strong>\/run\/shut.txt<\/strong> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0434\u043b\u044f \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u042d\u0442\u043e \u0432\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430. \u041f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u044d\u0444\u0444\u0435\u043a\u0442.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e \u0435\u0451 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u043c, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438  &#8212; \u044d\u0442\u043e \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u0447\u0435\u0431\u043d\u0438\u043a\u0430 \u043f\u043e \u044f\u0437\u044b\u043a\u0443 C.<\/p>\n<p>1) \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 <strong>\/run\/shut.txt<\/strong> \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c: <\/p>\n<p><strong>check_shutdown_reboot_file.c<\/strong><\/p>\n<pre><code class=\"cpp\">#include &lt;stdio.h> #include &lt;fcntl.h> #include &lt;unistd.h> int main () {  mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; char *filename = \"\/run\/shut.txt\"; \/*C\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u0440\u0430\u0432\u0430 \u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430*\/     creat(filename, mode);     chown(filename, 1000, 0); }<\/code><\/pre>\n<p>2) \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430:<\/p>\n<p><strong>shut_and_reb.c<\/strong> <\/p>\n<pre><code class=\"cpp\">#include &lt;stdio.h> #include &lt;stdlib.h> int main () {     char c;     FILE *file; \/*\u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u043c.*\/         file = fopen(\"\/run\/shut.txt\", \"r\");     c = getc (file);     if (c == '9')     system(\"\/sbin\/reboot\");     if (c == '8')     system(\"\/sbin\/poweroff\");     fclose(file); }<\/code><\/pre>\n<p>3) \u0421\u043a\u0440\u0438\u043f\u0442 sh (\u043a\u043d\u043e\u043f\u043a\u0430) \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 (\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \/usr\/local\/bin \u0438\u043b\u0438 \/home\/USER\/bin \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c alias): <\/p>\n<p><strong>reboot_com.sh<\/strong><\/p>\n<pre><code class=\"bash\">echo 9 > \/run\/shut.txt amixer set Master off &amp; amixer set Master toggle &amp; beep -f 2200 -l 3000<\/code><\/pre>\n<p>4) 3) \u0421\u043a\u0440\u0438\u043f\u0442 sh (\u043a\u043d\u043e\u043f\u043a\u0430) \u0434\u043b\u044f \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \/usr\/local\/bin \u0438\u043b\u0438 \/home\/USER\/bin \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c alias, etc): <\/p>\n<p><strong>shutdown_comp.sh<\/strong><\/p>\n<pre><code class=\"bash\">echo 8 > \/run\/shut.txt amixer set Master off &amp; amixer set Master toggle &amp; beep -f 2200 -l 3000 #mplayer \/home\/iv\/\u041c\u0443\u0437\u044b\u043a\u0430\/zavershenie-raboty-cistemnyy-zvuk-windows-xp.mp3<\/code><\/pre>\n<p>5)  \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <strong>crontab -e<\/strong> \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root:<\/p>\n<pre><code class=\"bash\">@reboot \/usr\/local\/bin\/check_shutdown_reboot_file *\/1 * * * * \/usr\/local\/bin\/shut_or_reb<\/code><\/pre>\n<p>P.S.<\/p>\n<p><a href=\"https:\/\/gitflic.ru\/project\/dcc0\/system-reboot-control\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u0434 \u043d\u0430 Gitflic.ru<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/703924\/\"> https:\/\/habr.com\/ru\/post\/703924\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><em>\u0414\u0435\u043b\u0430\u0435\u043c \u0438\u0437 \u043c\u0443\u0445\u0438 \u0441\u043b\u043e\u043d\u0430 \u0438\u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u043f\u0438\u043d\u0433\u0432\u0438\u043d\u0430<\/em><\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p><strong>\u0412\u0432\u0440\u0434\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Gentoo Linux \u043d\u0430 \u0441\u0432\u043e\u0439 \u043d\u0435\u0442\u0431\u0443\u043a \u044f \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0435\u0442 \u0448\u0442\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <strong>sudo.<\/strong><\/p>\n<p><strong>\u0417\u0430\u0449\u0438\u0442\u043d\u043e\u0435 \u0437\u0430\u044f\u043b\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0430<\/strong><\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0435 \u043f\u0440\u0438\u0437\u044b\u0432\u0430\u044e  \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a  \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043c\u043d\u043e\u0439, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438 \u043f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043e. \u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0430\u0432\u0442\u043e\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u043a\u043e\u0434 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445.<\/p>\n<p><strong>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Gentoo Linux \u043d\u0430 \u0441\u0432\u043e\u0439 \u043d\u0435\u0442\u0431\u0443\u043a \u044f \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0435\u0442 \u0448\u0442\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0432\u0440\u043e\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b <strong>sudo,<\/strong> \u0430 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430<br \/><strong>\/etc\/group<\/strong> \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e, \u0447\u0442\u043e \u0432 \u043d\u0451\u043c \u043d\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u044b <strong>operator.<\/strong> \u041b\u044e\u0431\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0443 \u0433\u0440\u0443\u043f\u043f\u0443 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043d\u0435\u0451 \u043d\u0435 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0438 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 &#8212; \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u043b\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/p>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0440\u0430\u0437\u043c\u044b\u0441\u043b\u0438\u0432, \u044f \u043f\u0440\u0438\u0448\u0451\u043b \u043a  \u0438\u0434\u0435\u0438 (\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044f \u043d\u0435 \u0431\u044b\u043b \u043f\u0435\u0440\u0432\u044b\u043c) \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a <strong>cron<\/strong> \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 . \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0439 \u043d\u0430\u0441\u043a\u043e\u0440\u043e \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 <strong>bash<\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0432  cron \u0434\u043b\u044f \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<br \/>\u0421\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u0440\u0430\u0437 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443 \u043e\u0442 <strong>root,<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u0444\u0430\u0439\u043b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432 \u043d\u0451\u043c <strong>\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/strong> \u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u043b  \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0432 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b  <strong>\u043a\u043e\u0434 0<\/strong> \u0434\u043b\u044f \u0431\u0435\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0435 \u043d\u0430\u0447\u0430\u043b \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e. \u042f \u0438 \u0441\u0430\u043c \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 \u0441\u043e\u0437\u0434\u0430\u043b \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 (\u0445\u043e\u0442\u044f \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438).  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c \u0444\u043e\u0440\u0443\u043c\u0430 <a href=\"http:\/\/Linux.org.ru\" rel=\"noopener noreferrer nofollow\">Linux.org.ru<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0432\u0440\u0435\u043c\u044f<a href=\"https:\/\/www.linux.org.ru\/forum\/desktop\/17045140?cid=17045842\" rel=\"noopener noreferrer nofollow\"> \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043c\u043d\u0435<\/a> \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 <a href=\"https:\/\/www.linux.org.ru\/forum\/desktop\/17045140?cid=17045842\" rel=\"noopener noreferrer nofollow\">\u0434\u0430\u043b\u0438 \u0440\u044f\u0434 \u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u0432\u0435\u0442\u043e\u0432<\/a> \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043c\u043e\u0435\u0439 \u0441\u043a\u0440\u043e\u043c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<ol>\n<li>\n<p>\u041d\u0430 \u044f\u0437\u044b\u043a\u0435 C \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f 1 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0447\u0435\u0440\u0435\u0437 <strong>\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a cron<\/strong> \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b  <strong>\/run\/shut.txt<\/strong>. \u0414\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u043b\u044f <strong>root<\/strong>  \u0438 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.  \u0425\u043e\u0437\u044f\u0438\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 C, \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430  \u0432 \u0444\u0430\u0439\u043b\u0435  <strong>\/run\/shut.txt.<\/strong><\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f, \u0442\u043e <strong>\u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/strong><\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0434\u0432\u0430 <strong>sh<\/strong> \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b <strong>\/run\/shut.txt<\/strong> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0434\u043b\u044f \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u042d\u0442\u043e \u0432\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430. \u041f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u044d\u0444\u0444\u0435\u043a\u0442.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e \u0435\u0451 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u043c, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438  &#8212; \u044d\u0442\u043e \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u0447\u0435\u0431\u043d\u0438\u043a\u0430 \u043f\u043e \u044f\u0437\u044b\u043a\u0443 C.<\/p>\n<p>1) \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 <strong>\/run\/shut.txt<\/strong> \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c: <\/p>\n<p><strong>check_shutdown_reboot_file.c<\/strong><\/p>\n<pre><code class=\"cpp\">#include &lt;stdio.h> #include &lt;fcntl.h> #include &lt;unistd.h> int main () {  mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; char *filename = \"\/run\/shut.txt\"; \/*C\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u0440\u0430\u0432\u0430 \u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430*\/     creat(filename, mode);     chown(filename, 1000, 0); }<\/code><\/pre>\n<p>2) \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430:<\/p>\n<p><strong>shut_and_reb.c<\/strong> <\/p>\n<pre><code class=\"cpp\">#include &lt;stdio.h> #include &lt;stdlib.h> int main () {     char c;     FILE *file; \/*\u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u043c.*\/         file = fopen(\"\/run\/shut.txt\", \"r\");     c = getc (file);     if (c == '9')     system(\"\/sbin\/reboot\");     if (c == '8')     system(\"\/sbin\/poweroff\");     fclose(file); }<\/code><\/pre>\n<p>3) \u0421\u043a\u0440\u0438\u043f\u0442 sh (\u043a\u043d\u043e\u043f\u043a\u0430) \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 (\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \/usr\/local\/bin \u0438\u043b\u0438 \/home\/USER\/bin \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c alias): <\/p>\n<p><strong>reboot_com.sh<\/strong><\/p>\n<pre><code class=\"bash\">echo 9 > \/run\/shut.txt amixer set Master off &amp; amixer set Master toggle &amp; beep -f 2200 -l 3000<\/code><\/pre>\n<p>4) 3) \u0421\u043a\u0440\u0438\u043f\u0442 sh (\u043a\u043d\u043e\u043f\u043a\u0430) \u0434\u043b\u044f \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \/usr\/local\/bin \u0438\u043b\u0438 \/home\/USER\/bin \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c alias, etc): <\/p>\n<p><strong>shutdown_comp.sh<\/strong><\/p>\n<pre><code class=\"bash\">echo 8 > \/run\/shut.txt amixer set Master off &amp; amixer set Master toggle &amp; beep -f 2200 -l 3000 #mplayer \/home\/iv\/\u041c\u0443\u0437\u044b\u043a\u0430\/zavershenie-raboty-cistemnyy-zvuk-windows-xp.mp3<\/code><\/pre>\n<p>5)  \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <strong>crontab -e<\/strong> \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root:<\/p>\n<pre><code class=\"bash\">@reboot \/usr\/local\/bin\/check_shutdown_reboot_file *\/1 * * * * \/usr\/local\/bin\/shut_or_reb<\/code><\/pre>\n<p>P.S.<\/p>\n<p><a href=\"https:\/\/gitflic.ru\/project\/dcc0\/system-reboot-control\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u0434 \u043d\u0430 Gitflic.ru<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/703924\/\"> https:\/\/habr.com\/ru\/post\/703924\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-342241","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=342241"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342241\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}