running perl script on logout

estelbk
New Contributor

We currently run a perl script on login and logout that triggers a boolean field in a dB that we then use to create a computer map showing which computers in our library are currently in use.  Unfortunately for us, jamf is deprecating the login/logout triggers.  We can use "login items" to run the script on login.  My troubles come trying to run the logout script on logout.  

Does anyone have any suggestions on how I might accomplish this?  

Thanks in advance for any help!

 

1 REPLY 1

talkingmoose
Honored Contributor II
Honored Contributor II

Apple warned a long time ago that it was deprecating login/logout hooks, which is why Jamf is doing the same. Jamf will provide other means to enable triggers at login to continue to work.

However, logout items have always been problematic. Many administrators have tried triggering items at logout that really weren't appropriate and would cause issues (e.g. cause the logout to time out or prevent the Mac from restarting in a timely manner).

My suggestion is to move away from both login/logout triggers and instead use a launchd launch daemon. A launch daemon runs as root with or without a user logged in and it can be scheduled to run periodically. One daemon could call a single script that verifies whether the computer is in use and then update your database. I would suggest a five minute interval to avoid congestion with any other processes trying to run.

My favorite tool for creating launchd items is Lingon. Another app is LaunchControl