
These are the decoration greeting script that shows information and users who are currently logged in decorated ascii arts and colors while ssh into mobile server.
28 lines
774 B
Bash
28 lines
774 B
Bash
#greet banner NAS
|
|
toilet -f bigascii12 -F metal NAS
|
|
|
|
# Define greet function
|
|
greet() {
|
|
# Display the message inside a rectangle box with a smaller font size using toilet
|
|
echo -e "\033[1;37m$(echo -e "$status")" | toilet -t -f term -F border -w 120 -W
|
|
|
|
}
|
|
|
|
|
|
# Count the number of devices connected via ssh on port 8022
|
|
netstatcount=$(netstat | grep ':8022' | grep 'ESTABLISHED' | wc -l)
|
|
tempcount=$((netstatcount - netstatcount / 2))
|
|
actualcount=$((tempcount - 1))
|
|
|
|
|
|
# Use that count to decide the process flow
|
|
if [ $tempcount -gt 1 ]; then
|
|
status="Welcome to Arul's Android NAS server. \n [$actualcount devices were connected to NAS]"
|
|
greet;
|
|
else
|
|
status="Welcome to Arul's Android NAS server. \n [$actualcount device were connected to NAS]"
|
|
greet;
|
|
fi
|
|
|
|
|