Skip to content

Instantly share code, notes, and snippets.

@pajp
Created January 10, 2014 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pajp/8356234 to your computer and use it in GitHub Desktop.
Save pajp/8356234 to your computer and use it in GitHub Desktop.
Generate a report of all VPN connects, system sleeps, and "location-awareness" messages for the last seven days. "location-awareness" log messages are generated by ControlPlane actions that are triggered based on my geographical location (home or work).
#!/bin/sh
reportfile=/vpn-reports/`date +%Y-%m-%d`.txt
echo "**** VPN report generated @ `date` ****" > $reportfile
syslog -k Sender pppd \
-k Message "L2TP connection established." \
-o -k Message "L2TP disconnected" \
-o -k Sender location-awareness \
-k Time ge -7d \
-o -k Message Seq "System Sleep" \
-k Sender kernel >> $reportfile
@pajp
Copy link
Author

pajp commented Jan 10, 2014

The "location-awareness" ControlPlane actions are one-liner shell scripts looking like this:

logger -t location-awareness "Arrived at home"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment