Skip to content

Commit

Permalink
falter-common: add /etc/profile.d/dynbanner.sh
Browse files Browse the repository at this point in the history
At login time the script dynbanner.sh fetches some dynamic system
information and prints it under the regular banner.
  • Loading branch information
Akira25 committed Oct 26, 2020
1 parent 7268caa commit 3feb2e6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/falter-common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=falter-common
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

Expand Down
21 changes: 21 additions & 0 deletions packages/falter-common/files-common/etc/profile.d/dynbanner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

# Get dynamic information and print them under the banner.

HOSTNAME=$(uci -q get system.@system[0].hostname)".olsr"
IPADDR=$(uci -q get network.dhcp.ipaddr)
UPTIME=$(uptime | cut -d ',' -f 0 | cut -d ' ' -f 4-)
FREEFL=$(df -h | grep " /overlay" | sed -E -e s/[[:space:]]+/\;/g | cut -d';' -f4 )
SYS_LOAD=$(uptime | sed -e 's/average: /;/g' | cut -d';' -f2)
CLIENTS=$(wc -l /tmp/dhcp.leases | cut -d' ' -f1)

printf \
" Host.............................: $HOSTNAME
IP-Address.......................: $IPADDR
Uptime...........................: $UPTIME
Free flash.......................: $FREEFL
Average load (1m, 5m, 15m).......: $SYS_LOAD
DHCP-Clients.....................: $CLIENTS
"

0 comments on commit 3feb2e6

Please sign in to comment.