#!/bin/bash # --- Script: /usr/local/bin/monitor-who # --- Author: Paul Greene # --- Objective: Monitor who's on local server (NODE1) and a remote server (NODE2), from local # --- server and log it on NODE1 # --- PRE-REQUISISTE: SSH key pair access NEEDS to be set up between NODE1 and NODE2 WHONODE1=`/usr/local/bin/security-who` WHONODE2=`ssh -p 22 monitor@192.168.1.11 exec /bin/bash -s "$LE_PATH" < /usr/local/bin/security-who` echo "NODE1: $WHONODE1" | /usr/local/bin/timestamp | tee -ai /var/log/monitor-security-who.log echo "NODE2: $WHONODE2" | /usr/local/bin/timestamp | tee -ai /var/log/monitor-security-who.log #!/bin/bash # --- Script: /usr/local/bin/timestamp # --- Author: Paul Greene # --- Objective: Act as a timestamp for log output while read line ; do echo "$(date): ${line}" done #!/bin/bash # --- Script: /usr/local/bin/security-who # --- Author: Paul Greene # --- Objective: Capture who's on the server who -u --lookup # Enjoy!