Last active
April 26, 2018 23:09
-
-
Save DasFranck/7fc7f1d23cc09d15950fdc2d8036a48c to your computer and use it in GitHub Desktop.
A shell function showing a nice service summary. (thanks to /u/rmw5601for the base function)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rc(){ | |
systemctl list-unit-files --type=service |\ | |
sed 's/.service//g' |\ | |
sed '/static/d' |\ | |
sed '/indirect/d' |\ | |
sed '/systemd/d' |\ | |
sed '/dbus-org/d' |\ | |
sed '/canberra/d'|\ | |
sed '/wpa_supplicant/d' |\ | |
sed '/netctl/d' |\ | |
sed '/rfkill/d' |\ | |
sed '/krb5/d' |\ | |
tail -n+2 |\ | |
head -n -2 |\ | |
sed 's/\(^.*enabled.*$\)/[x] \1/' |\ | |
sed 's/enabled//g' |\ | |
sed 's/\(^.*disabled.*$\)/[ ] \1/' |\ | |
sed 's/disabled//g' |\ | |
sed 's/[ \t]*$//' |\ | |
while read line; do | |
if [[ $line == *'[x]'* ]]; then | |
printf "\033[0;32m$line\n" | |
else | |
printf "\033[1;30m$line\n" | |
fi | |
done | |
syncthing_status=`systemctl is-active syncthing@${USER}.service` | |
if [[ $syncthing_status == "active" ]]; then | |
printf "\033[0;32m[x] syncthing (${USER})\n" | |
else | |
printf "\033[1;30m[ ] syncthing (${USER})\n" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment