Last active
February 24, 2024 14:09
-
-
Save riipandi/9368730 to your computer and use it in GitHub Desktop.
Dynamic SSH Banner (Tutorial by http://oitibs.com/debian-wheezy-dynamic-motd/)
This file contains 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
#!/bin/sh | |
# | |
# 00-header - create the header of the MOTD | |
# Copyright (c) 2013 Nick Charlton | |
# Copyright (c) 2009-2010 Canonical Ltd. | |
# | |
# Authors: Nick Charlton <[email protected]> | |
# Dustin Kirkland <[email protected]> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. | |
[ -r /etc/lsb-release ] && . /etc/lsb-release | |
if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then | |
# Fall back to using the very slow lsb_release utility | |
DISTRIB_DESCRIPTION=$(lsb_release -s -d) | |
fi | |
#figlet $(hostname -f) | |
figlet "Murukusunu /" | |
#printf "\n" | |
#printf "Welcome to %s (%s).\n" "$DISTRIB_DESCRIPTION" "$(uname -r)" | |
#printf "\n" |
This file contains 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
#!/bin/sh | |
# | |
# 10-sysinfo - generate the system information | |
# Copyright (c) 2013 Nick Charlton | |
# Copyright (c) 2009-2010 Canonical Ltd. | |
# | |
# Authors: Nick Charlton <[email protected]> | |
# Dustin Kirkland <[email protected]> | |
# http://oitibs.com/debian-wheezy-dynamic-motd/ | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. | |
# time of day | |
HOUR=$(date +"%H") | |
if [ $HOUR -lt 12 -a $HOUR -ge 0 ]; then | |
TIME="morning" | |
elif [ $HOUR -lt 17 -a $HOUR -ge 12 ]; then | |
TIME="afternoon" | |
else | |
TIME="evening" | |
fi | |
# System uptime | |
uptime=`cat /proc/uptime | cut -f1 -d.` | |
upDays=$((uptime/60/60/24)) | |
upHours=$((uptime/60/60%24)) | |
upMins=$((uptime/60%60)) | |
MEMORY1=`free -t -m | grep "buffers/cache" | awk '{print $3" MB";}'` | |
MEMORY2=`free -t -m | grep "Mem" | awk '{print $2" MB";}'` | |
# System + Memory | |
SYS_LOADS=`cat /proc/loadavg | awk '{print $1}'` | |
SWAP_USED=`free -m | tail -n 1 | awk '{print $3}'` | |
NUM_PROCS=`ps aux | wc -l` | |
IPADDRESS=`ifconfig | sed -n 's/.*inet addr:\([0-9.]\+\)\s.*/\1/p' | grep -v '127.0'` | |
# Cek Update | |
CEK_UPDATE1=`/usr/lib/update-notifier/apt-check --human-readable | grep "can be updated"` | |
CEK_UPDATE2=`/usr/lib/update-notifier/apt-check --human-readable | grep "security updates"` | |
echo " | |
=================================================================== | |
- Good $TIME `whoami`. Wilujeng sumping !! | |
=================================================================== | |
- Hostname............: `hostname -f` | |
- IP Address..........: $IPADDRESS | |
- Release.............: `uname -a | awk '{print $1" "$3" "$12}'` | |
- Users...............: Currently `users | wc -w` user(s) logged on | |
- Server Time.........: `date` | |
=================================================================== | |
- System load.........: $SYS_LOADS / $NUM_PROCS processes running | |
- Memory used.........: $MEMORY1 / $MEMORY2 | |
- Swap in use.........: $SWAP_USED MB | |
- System uptime.......: $upDays days $upHours hours $upMins minutes | |
=================================================================== | |
- Available updates...: $CEK_UPDATE1 | |
- Security updates....: $CEK_UPDATE2 | |
=================================================================== | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment