{"id":300032,"date":"2020-03-12T15:00:36","date_gmt":"2020-03-12T15:00:36","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=300032"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=300032","title":{"rendered":"\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u043a\u0440\u044b\u0448\u043a\u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 \u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 \u0431\u0435\u0437 \u0441\u043d\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/491486\/\">\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u042f \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c Lubuntu 18.04 \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435. \u0412 \u043e\u0434\u0438\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0434\u0435\u043d\u044c \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043c\u0435\u043d\u044f \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 Power Manager \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u043a\u0440\u044b\u0448\u043a\u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430. \u042f \u0445\u043e\u0442\u0435\u043b \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u043a\u0440\u044b\u0448\u043a\u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0432 \u0433\u0438\u0431\u0435\u0440\u043d\u0430\u0446\u0438\u044e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0441\u043f\u0435\u0448\u0443 \u0438\u043c \u0441 \u0432\u0430\u043c\u0438 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u042f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u0430\u044f \u2014 \u0432 \u043b\u0443\u0431\u0443\u043d\u0442\u0435 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0433\u0438\u0431\u0435\u0440\u043d\u0430\u0446\u0438\u044f, \u0434\u043b\u044f \u0435\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.<\/p>\n<p>  \u041d\u0430\u0439\u0442\u0438 UUID swap, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:<\/p>\n<pre><code class=\"bash\">grep swap \/etc\/fstab<\/code><\/pre>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0432\u043e\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<pre><code class=\"bash\"># swap was on \/dev\/mmcblk0p2 during installation UUID=aebf757e-14c0-410a-b042-3d9a6044a987 none            swap    sw              0       0 <\/code><\/pre>\n<p>  \u041f\u043e\u0442\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c UUID \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044f\u0434\u0440\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 \/etc\/default\/grub \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u00abGRUB_CMDLINE_LINUX_DEFAULT\u00bb resume=UUID=%\u0432\u0430\u0448 UUID%<\/p>\n<pre><code class=\"bash\">... GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet splash resume=UUID=aebf757e-14c0-410a-b042-3d9a6044a987&quot; ...<\/code><\/pre>\n<p>  \u0418 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"bash\">sudo update-grub<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0433\u0438\u0431\u0435\u0440\u043d\u0430\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:<\/p>\n<pre><code class=\"bash\">sudo systemctl hibernate<\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u044b\u043b\u0430 \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0442 root&#8217;\u0430, \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0432 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0432 \u0441\u043e\u043d. \u042f \u0440\u0435\u0448\u0438\u043b \u0435\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e dbus-send, \u0441\u0430\u043c\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0438\u0436\u0435. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e \u0442\u043e \u0437\u043d\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 Power Manager, \u044d\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c Switch off display (\u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u043a\u0440\u0430\u043d) \u043a\u0430\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u043a\u0440\u044b\u0448\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432 \u0441 \u043d\u0430\u0448\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ve\/vx\/3i\/vevx3ieyswyr8g0h80rpz5lxpuy.png\" alt=\"image\"><\/p>\n<p>  \u041f\u043e\u0442\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \/etc\/acpi\/events\/laptop-lid \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre><code class=\"plaintext\">event=button\/lid.* action=\/etc\/acpi\/laptop-lid.sh<\/code><\/pre>\n<p>  \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \/etc\/acpi\/laptop-lid.sh \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  #set variables #\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c BUS \u0430\u0434\u0440\u0435\u0441 \u0438\u0437 environ \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 lxsession BUS=$(grep -z DBUS_SESSION_BUS_ADDRESS \\ \t\/proc\/$(pidof -s lxsession)\/environ | \\ \tsed 's\/DBUS_SESSION_BUS_ADDRESS=\/\/g') #\u0418\u0437 \u0442\u043e\u0433\u043e \u0436\u0435 \u0444\u0430\u0439\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u044e\u0437\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 USER=$(grep -z USER \/proc\/$(pidof -s lxsession)\/environ | sed 's\/USER=\/\/g') #\u043f\u0443\u0442\u044c \u0434\u043e \u0441\u0442\u0435\u0439\u0442 \u0444\u0430\u0439\u043b\u0430 \u043a\u0440\u044b\u0448\u043a\u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 LID=&quot;\/proc\/acpi\/button\/lid\/LID0\/state&quot;  #Check lid state (return 0 if closed) check_lid () { \tgrep -q closed $LID }  #Lock screen without sleep check_lid if [ $? = 0 ] then \t#TODO run command as root \tsudo -u $USER -E dbus-send --bus=$BUS \\ \t\t\t\t    --type=method_call \\ \t\t\t\t    --dest=&quot;org.freedesktop.ScreenSaver&quot; \\ \t\t\t\t    &quot;\/org\/freedesktop\/ScreenSaver&quot; \\ \t\t\t\t    org.freedesktop.ScreenSaver.Lock fi  #Wait 10 minutes and hibernate if lid is closed sleep 600 check_lid if [ $? = 0 ] then \tsystemctl hibernate fi<\/code><\/pre>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c:<\/p>\n<pre><code class=\"bash\">sudo chmod a+x \/etc\/acpi\/laptop-lid.sh<\/code><\/pre>\n<p>  \u0418 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0434\u0435\u043c\u043e\u043d\u0430 acpid, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c:<\/p>\n<pre><code class=\"bash\">sudo systemctl restart acpid.service<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e.<\/p>\n<p>  \u0414\u043b\u044f Gnome \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c:<\/p>\n<ul>\n<li>lxsessin =&gt; gnome-session <\/li>\n<li>org.freedesktop.ScreenSaver =&gt; org.gnome.ScreenSaver <\/li>\n<\/ul>\n<\/div>\n<p> \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\/491486\/\"> https:\/\/habr.com\/ru\/post\/491486\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/491486\/\">\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u042f \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c Lubuntu 18.04 \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435. \u0412 \u043e\u0434\u0438\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0434\u0435\u043d\u044c \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043c\u0435\u043d\u044f \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 Power Manager \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u043a\u0440\u044b\u0448\u043a\u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430. \u042f \u0445\u043e\u0442\u0435\u043b \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u043a\u0440\u044b\u0448\u043a\u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0432 \u0433\u0438\u0431\u0435\u0440\u043d\u0430\u0446\u0438\u044e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0441\u043f\u0435\u0448\u0443 \u0438\u043c \u0441 \u0432\u0430\u043c\u0438 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.  <\/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-300032","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/300032","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=300032"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/300032\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=300032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=300032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=300032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}