I will sometimes remote into my work computer from home using TeamViewer. Obviously I have to unlock the screensaver to use the GUI.
When I'm done, I'll lock the screen either from the desktop or via an ssh command.
However, during that time, suppose a maintenance worker comes into my office, physically removes the ethernet cable (or otherwise permanently interrupts my connection), and has an unlocked desktop?
Is there a simple way to automatically run the screen lock command if the computer detects that it has lost its internet connection? Preferably, it would not re-arm itself until connectivity is restored.
I don't mind if this means a quick network outage while at work causes my screen to lock. I'll just unlock the screen and keep working, sans internet.
Is there a service out there already for this? Or should I just have a cron job run every minute, making sure it can ping 'google.com', and run the 'lock' script if ping fails?