feat: manage motd for alpine
This commit is contained in:
parent
726aa54dbb
commit
24ec59e4c0
3 changed files with 34 additions and 1 deletions
23
templates/motd/alpine-motd.sh.j2
Normal file
23
templates/motd/alpine-motd.sh.j2
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
# distribution information
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
linux_distribution="\033[36m$PRETTY_NAME\033[0m"
|
||||
else
|
||||
linux_distribution="\033[36mUnknown Linux Distribution\033[0m"
|
||||
fi
|
||||
|
||||
# disk usage
|
||||
disk_usage=$(df -h / | awk 'NR==2 {print $3 " / " $2 " (" $5 ")"}')
|
||||
|
||||
# memory usage
|
||||
memory_usage=$(free -m | awk 'NR==2 {print $3 " MB / " $2 " MB (" int($3/$2*100) "%)"}')
|
||||
|
||||
# display motd
|
||||
echo "Welcome to $(hostname)!"
|
||||
echo ""
|
||||
echo -e "$linux_distribution"
|
||||
echo "Disk Usage: $disk_usage"
|
||||
echo "Memory Usage: $memory_usage"
|
||||
echo ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue