I need to run my application in screen when specific users are logged out and kill the screen when someone from my user list logged in. So I am thinking about bash script, which will be called periodically from cron and:
- Checks if specific users are logged in.
- If nobody is logged in - spawn screen and save pid to file or do nothing if pid file already exists
- If someone is logged in - read pid from file and kill screen
I am looking for more sophisticated alternatives, which will eliminate periodically running script from cron.