-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
falter-common: add /etc/profile.d/dynbanner.sh
At login time the script dynbanner.sh fetches some dynamic system information and prints it under the regular banner.
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
packages/falter-common/files-common/etc/profile.d/dynbanner.sh
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
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 | ||
" |