add custom motd
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
date=`date`
|
||||
load=`cat /proc/loadavg | awk '{print $1}'`
|
||||
root_usage=`df -h / | awk '/\// {print $(NF-1)}'`
|
||||
memory_usage=`free -m | awk '/Mem:/ { total=$2 } /buffers\/cache/ { used=$3 } END { printf("%3.1f%%", used/total*100)}'`
|
||||
swap_usage=`free -m | awk '/Swap/ { printf("%3.1f%%", "exit !$2;$3/$2*100") }'`
|
||||
users=`users | wc -w`
|
||||
time=`uptime | grep -ohe 'up .*' | sed 's/,/\ hours/g' | awk '{ printf $2" "$3 }'`
|
||||
processes=`ps aux | wc -l`
|
||||
ip=`/sbin/ifconfig $(/sbin/route | grep default | awk '{ print $8 }') | grep -E -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2`
|
||||
|
||||
figlet $(hostname)
|
||||
|
||||
echo
|
||||
printf "System load:\t%s\tIP Address:\t%s\n" $load $ip
|
||||
printf "Memory usage:\t%s\tSystem uptime:\t%s\n" $memory_usage "$time"
|
||||
printf "Usage on /:\t%s\tSwap usage:\t%s\n" $root_usage $swap_usage
|
||||
printf "Local Users:\t%s\tProcesses:\t%s\n" $users $processes
|
||||
|
||||
echo
|
||||
@@ -1,4 +1,10 @@
|
||||
---
|
||||
- name: motd | copy custom motd
|
||||
copy:
|
||||
src: 11-custom
|
||||
dest: /etc/update-motd.d/11-custom
|
||||
mode: '0755'
|
||||
|
||||
- name: motd | copy reboot required script
|
||||
copy:
|
||||
src: 99-reboot-required
|
||||
|
||||
@@ -24,3 +24,4 @@
|
||||
- telnet
|
||||
- tmux
|
||||
- vim
|
||||
- figlet
|
||||
|
||||
Reference in New Issue
Block a user