finished motd
This commit is contained in:
@@ -24,11 +24,11 @@ in {
|
|||||||
environment.etc."motd".text = ''
|
environment.etc."motd".text = ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
active="\033[1;34m"
|
active=$'\033[1;34m'
|
||||||
inactive="\033[1;31m"
|
inactive=$'\033[1;31m'
|
||||||
headings="\033[1;35m"
|
headings=$'\033[1;35m'
|
||||||
bold="\e[1m"
|
bold=$'\e[1m'
|
||||||
reset="\033[0m"
|
reset=$'\033[0m'
|
||||||
memory=`free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)\n", $3,$2,$3*100 / $2 }'`
|
memory=`free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)\n", $3,$2,$3*100 / $2 }'`
|
||||||
load1=`cat /proc/loadavg | awk {'print $1'}`
|
load1=`cat /proc/loadavg | awk {'print $1'}`
|
||||||
load5=`cat /proc/loadavg | awk {'print $2'}`
|
load5=`cat /proc/loadavg | awk {'print $2'}`
|
||||||
@@ -62,13 +62,13 @@ in {
|
|||||||
${lib.concatStringsSep "\n" (map (service: ''
|
${lib.concatStringsSep "\n" (map (service: ''
|
||||||
if systemctl list-units --type=service --all | grep -q "${service}"; then
|
if systemctl list-units --type=service --all | grep -q "${service}"; then
|
||||||
status=$(systemctl is-active ${service} 2>/dev/null)
|
status=$(systemctl is-active ${service} 2>/dev/null)
|
||||||
if [ "''${status}" = "active" ]; then
|
if [ "$status" = "active" ]; then
|
||||||
echo -e " ''${active}${service}''${reset} - running"
|
printf "%-15s %s%s\n" "''${active}${service}''${reset}" "running"
|
||||||
else
|
else
|
||||||
echo -e " ''${inactive}${service}''${reset} - not running"
|
printf "%-15s %s%s\n" "''${active}${service}''${reset}" "not running"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e " ''${inactive}${service}''${reset} - not found"
|
printf "%-15s %s%s\n" "''${active}${service}''${reset}" "not found"
|
||||||
fi
|
fi
|
||||||
'')
|
'')
|
||||||
motd_list)}
|
motd_list)}
|
||||||
|
|||||||
Reference in New Issue
Block a user