diff options
author | eug-vs <eugene@eug-vs.xyz> | 2021-10-03 16:54:22 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2021-10-03 17:55:03 +0300 |
commit | 73909187df8ad31c630e8f753c19fd2a00f19533 (patch) | |
tree | 08131c7e0096e14cfb31c56af81a80b4188ae4dd /raspberry/.local/bin | |
parent | bbe0e7af9ff0381b1475bb414a6153f0bb947134 (diff) | |
download | dotfiles-73909187df8ad31c630e8f753c19fd2a00f19533.tar.gz |
feat(rpi): add services and packages to dashboard
Diffstat (limited to 'raspberry/.local/bin')
-rwxr-xr-x | raspberry/.local/bin/clock.sh | 2 | ||||
-rwxr-xr-x | raspberry/.local/bin/services-status.sh | 27 | ||||
-rwxr-xr-x | raspberry/.local/bin/temp.sh | 4 |
3 files changed, 33 insertions, 0 deletions
diff --git a/raspberry/.local/bin/clock.sh b/raspberry/.local/bin/clock.sh new file mode 100755 index 0000000..8cd5b4a --- /dev/null +++ b/raspberry/.local/bin/clock.sh @@ -0,0 +1,2 @@ +#!/bin/sh +tty-clock -scnS diff --git a/raspberry/.local/bin/services-status.sh b/raspberry/.local/bin/services-status.sh new file mode 100755 index 0000000..5eabee2 --- /dev/null +++ b/raspberry/.local/bin/services-status.sh @@ -0,0 +1,27 @@ +#!/bin/sh +SERVICES="nginx taskd syncthing@eug-vs sshd iwd chronyd" +USER_SERVICES="spotifyd" + +RED='\033[1;31m' +GREEN='\033[1;32m' +NC='\033[0m' # No Color + +for SERVICE in $SERVICES $USER_SERVICES; do + if [[ $(echo $USER_SERVICES | grep $SERVICE) ]]; then + SYSTEMD="systemctl --user" + else + SYSTEMD="systemctl" + fi; + + IS_ACTIVE=$($SYSTEMD is-active $SERVICE) + + if [[ "$IS_ACTIVE" == 'active' ]]; then + INDICATOR="$GREEN *$NC" + STATUS="$GREEN $IS_ACTIVE $NC" + else + STATUS="$RED $IS_ACTIVE $NC" + INDICATOR="$RED *$NC" + fi; + + echo -e "$INDICATOR $SERVICE $STATUS" +done; diff --git a/raspberry/.local/bin/temp.sh b/raspberry/.local/bin/temp.sh new file mode 100755 index 0000000..2c60aa2 --- /dev/null +++ b/raspberry/.local/bin/temp.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# Show CPU temperature in a cool way. Requires superuser permissions. + +watch -n 2 --no-title "/opt/vc/bin/vcgencmd measure_temp | sed 's/temp=//' | figlet -W | /usr/bin/cowsay -f ghostbusters -n | sed 's/^/ /'" |