{"id":349,"date":"2018-12-10T13:24:35","date_gmt":"2018-12-10T10:24:35","guid":{"rendered":"https:\/\/artem.services\/?p=349"},"modified":"2019-02-19T16:32:13","modified_gmt":"2019-02-19T13:32:13","slug":"bash-login-screen","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=349","title":{"rendered":"BASH &#8212; Login Screen"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-568 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/01\/BASH-Logo.png\" alt=\"\" width=\"376\" height=\"159\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/01\/BASH-Logo.png 376w, https:\/\/artem.services\/wp-content\/uploads\/2019\/01\/BASH-Logo-300x127.png 300w\" sizes=\"(max-width: 376px) 100vw, 376px\" \/><\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0430\u043a\u0435\u0442 &quot;<strong>figlet<\/strong>&quot; \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u043f\u0440\u0438 \u043b\u043e\u0433\u0438\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c <strong>MOTD<\/strong>:<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-350 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/linux-login-screen.png\" alt=\"\" width=\"839\" height=\"499\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/linux-login-screen.png 839w, https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/linux-login-screen-300x178.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/linux-login-screen-768x457.png 768w\" sizes=\"(max-width: 839px) 100vw, 839px\" \/><\/p>\n<p><!--more--><\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n\r\n# ENV\r\nGREEN=$(tput setaf 2)\r\nBLUE=&quot;$(tput setaf 4)&quot;\r\nYELLOW=&quot;$(tput setaf 4)&quot;\r\nPURPLE=&quot;$(tput setaf 5)&quot;\r\nWHITE=$(tput sgr 0)\r\n\r\n# System load\r\nSPACE_ROOT=`df -Ph | grep -e '\/$' | awk '{print $4}' | tr -d '\\n'`\r\nSPACE_HOME=`df -Ph | grep &quot;\/home\/&quot; | awk '{print $4}' | tr -d '\\n'`\r\nRAM_1=`free -t -m | grep &quot;\u0412\u0441\u0435\u0433\u043e&quot; | awk '{print $3&quot; MB&quot;;}'`\r\nRAM_2=`free -t -m | grep &quot;\u041f\u0430\u043c\u044f\u0442\u044c&quot; | awk '{print $2&quot; MB&quot;;}'`\r\nLA_1=`cat \/proc\/loadavg | awk {'print $1'}`\r\nLA_5=`cat \/proc\/loadavg | awk {'print $2'}`\r\nLA_15=`cat \/proc\/loadavg | awk {'print $3'}`\r\n\r\nclear\r\ntput setaf 3\r\nfiglet $(hostname)\r\ntput sgr 0\r\n\r\necho -e &quot;\r\n=====================================================================\r\n                             $PURPLE INFO $WHITE\r\n -$BLUE Hostname$(tput sgr 0)........................: $(tput setaf 2)$HOSTNAME $WHITE\r\n -$BLUE Uptime$(tput sgr 0)..........................:$(tput setaf 2)`uptime | cut -d ',' -f1` $WHITE\r\n=====================================================================\r\n                           $PURPLE SOURCES $WHITE\r\n -$BLUE CPU usage$WHITE.......................: $GREEN$LA_1, $LA_5, $LA_15 (1, 5, 15 min) $WHITE\r\n -$BLUE Memory used$WHITE.....................: $GREEN$RAM_1 \/ $RAM_2 $WHITE\r\n -$BLUE Swap in use$WHITE.....................: $GREEN`free -m | tail -n 1 | awk '{print $3}'` MB $WHITE\r\n -$BLUE Disk Space$WHITE (\/)..................: $GREEN$SPACE_ROOT remaining $WHITE\r\n=====================================================================\r\n&quot;\r\n<\/pre>\n<p>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u043e\u0447\u043a\u0430\u0445 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e \u043e\u0431\u0440\u0430\u0437\u0443 \u0438 \u043f\u043e\u0434\u043e\u0431\u0438\u044e \u0442\u043e\u0447\u043a\u0438 &quot;<strong>\/<\/strong>&quot;<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<h4>Ubuntu:<\/h4>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e &quot;<strong>\/etc\/update-motd.d\/<\/strong>&quot; \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h4>CentOS:<\/h4>\n<p>\u041d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 <strong>SSHD<\/strong> <strong>PrintMotd<\/strong>, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 &quot;<strong>\/etc\/ssh\/sshd_config<\/strong>&quot;, \u043d\u0430\u0445\u043e\u0434\u0438\u043c:<\/p>\n<pre>PrintMotd yes<\/pre>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043d\u0430:<\/p>\n<pre>PrintMotd no<\/pre>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043b\u0443\u0436\u0431\u0443:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl restart sshd\r\n<\/pre>\n<p>\u0418 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e &quot;<strong>\/etc\/profile.d<\/strong>&quot;<\/p>\n<h3>UDP: \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h3>\n<p><img loading=\"lazy\" class=\"size-full wp-image-417 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/linux-login-screen-2.png\" alt=\"\" width=\"760\" height=\"434\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/linux-login-screen-2.png 760w, https:\/\/artem.services\/wp-content\/uploads\/2018\/12\/linux-login-screen-2-300x171.png 300w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n\r\n# ENV\r\nRED=$(tput setaf 1)\r\nGREEN=$(tput setaf 2)\r\nBLUE=&quot;$(tput setaf 4)&quot;\r\nYELLOW=&quot;$(tput setaf 4)&quot;\r\nPURPLE=&quot;$(tput setaf 5)&quot;\r\nWHITE=$(tput sgr 0)\r\n\r\n# System load\r\nSPACE_ROOT=`df -Ph | grep -e '\/$' | awk '{print $4}' | tr -d '\\n'`\r\nSPACE_HOME=`df -Ph | grep &quot;\/home\/&quot; | awk '{print $4}' | tr -d '\\n'`\r\nRAM_1=`free -t -m | grep &quot;Total&quot; | awk '{print $3&quot; MB&quot;;}'`\r\nRAM_2=`free -t -m | grep &quot;RAM&quot; | awk '{print $2&quot; MB&quot;;}'`\r\nLA_1=`cat \/proc\/loadavg | awk {'print $1'}`\r\nLA_5=`cat \/proc\/loadavg | awk {'print $2'}`\r\nLA_15=`cat \/proc\/loadavg | awk {'print $3'}`\r\n\r\n# Services\r\nSERVICES=&quot;openvpn@server nginx php-fpm mariadb memcached&quot;\r\n\r\nclear\r\ntput setaf 3\r\nfiglet $(hostname)\r\ntput sgr 0\r\n\r\necho -e &quot;\r\n=====================================================================\r\n                             $PURPLE INFO $WHITE\r\n -$BLUE Hostname$(tput sgr 0)........................: $(tput setaf 2)$HOSTNAME $WHITE\r\n -$BLUE Uptime$(tput sgr 0)..........................:$(tput setaf 2)`uptime | cut -d ',' -f1` $WHITE\r\n=====================================================================\r\n                           $PURPLE SOURCES $WHITE\r\n -$BLUE CPU usage$WHITE.......................: $GREEN$LA_1, $LA_5, $LA_15 (1, 5, 15 min) $WHITE\r\n -$BLUE Memory used$WHITE.....................: $GREEN$RAM_1 \/ $RAM_2 $WHITE\r\n -$BLUE Swap in use$WHITE.....................: $GREEN`free -m | tail -n 1 | awk '{print $3}'` MB $WHITE\r\n -$BLUE Disk Space$WHITE (\/)..................: $GREEN$SPACE_ROOT remaining $WHITE\r\n=====================================================================\r\n                           $PURPLE SERVICES $WHITE&quot;\r\n\r\nfor i in $SERVICES\r\ndo\r\n    if \/usr\/bin\/systemctl status $i | grep -q &quot;Active: active (running)&quot;\r\n    then\r\n        i=$(echo $i | cut -d '@' -f1)\r\n        LENGHT=$(echo $i | wc -c)\r\n        DOT=$[ 23 - $LENGHT ]\r\n        echo -e &quot; -$BLUE Service: $WHITE$i&quot; | tr -s '\\r\\n' '.'\r\n        for ((n=0;n&lt;$DOT;n++))\r\n        do\r\n            echo '.' | tr -s '\\r\\n' '.'\r\n        done\r\n        echo -e &quot;:$GREEN RUNNING $WHITE&quot;\r\n    else\r\n        i=$(echo $i | cut -d '@' -f1)\r\n        LENGHT=$(echo $i | wc -c)\r\n        DOT=$[ 23 - $LENGHT ]\r\n        echo -e &quot; -$BLUE Service: $WHITE$i&quot; | tr -s '\\r\\n' '.'\r\n        for ((n=0;n&lt;$DOT;n++))\r\n        do\r\n            echo '.' | tr -s '\\r\\n' '.'\r\n        done\r\n        echo -e &quot;:$RED NOT RUNNING $WHITE&quot;\r\n    fi\r\ndone\r\n\r\necho &quot;=====================================================================&quot;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0430\u043a\u0435\u0442 &quot;figlet&quot; \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0412\u043e\u0442 \u0442\u0430\u043a \u043f\u0440\u0438 \u043b\u043e\u0433\u0438\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c MOTD:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[88],"tags":[89,108],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/349"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=349"}],"version-history":[{"count":9,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/349\/revisions"}],"predecessor-version":[{"id":659,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/349\/revisions\/659"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}