Victor Aguiar Posted February 7, 2014 Posted February 7, 2014 I need to create and run a scheduled script (or script sequence) that will give me a list of what accounts are logged in, then change a field in a record for each account holder. Any resources anyone could point me to for learning how to do this?
Steven H. Blackwell Posted February 7, 2014 Posted February 7, 2014 This can probably be done. But what are you trying to achieve in the end here? There may be another way to get you the information you need. Steven
cjcj01 Posted February 10, 2014 Posted February 10, 2014 Would be helpful to know if you're on Windows or a Mac... You can use PSLoggedOn on Windows or Who or Users on Unix/Mac via a system level script to return a list of users logged on. You could then pipe this output to a text file and import this in to a global text field, and parse it in Filemaker to get a value list of logged in users. However, I'm not sure how you'd do this on demand as system level scripts are run as scheduled scripts on the server which you can't call from FMPro.. but you might want to look here for a way round this if you need this functionality: http://fmforums.com/forum/topic/85738-call-upon-server-to-run-a-backup-from-pro/ As Steven said, what's the end goal here?
Victor Aguiar Posted February 11, 2014 Author Posted February 11, 2014 Thanks for your replies. A little more info. This applies to a database running in FMS 13 on a Windows 2008 server. It is used exclusively by our staff via Web Direct. When a user logs in to the database, a startup script sets a field value to "ON" so other users can see who is currently logged in. An exit script clears the field, but that doesn't happen if the user times out or just closes the browser window. Ideally, I would get people to exit properly, but human nature makes that a losing battle. I want to set up a scheduled script on the server that periodically checks to see who is actually logged in, and then clears that field for those who have timed out. I can script the clearing of the field, but I need a way to to feed it which accounts are actually logged in. Hopefully this clarifies. Thanks again -- Victor
Wim Decorte Posted February 11, 2014 Posted February 11, 2014 You can use PSLoggedOn on Windows or Who or Users on Unix/Mac via a system level script to return a list of users logged on. You could then pipe this output to a text file and import this in to a global text field, and parse it in Filemaker to get a value list of logged in users. That's the general idea but instead that of using PSloggedOn or its mac equivalent you need to use the fmsadmin command line. There is a switch to ask for detailed user info. Pipe that to a text file in the FMS documents folder and import it into a scratch table in your solution.
Victor Aguiar Posted March 8, 2014 Author Posted March 8, 2014 This worked well, with one glitch. It returns user name rather than account, which what I need to match. The user name is not always consistent with the field I can match. I can't find a command that will return the account name. Thanks for your help. -- Victor
Wim Decorte Posted March 8, 2014 Posted March 8, 2014 The whole approach should be coupled with writing the OS account name to the FM prefs area and using external authentication. There are may variables to this. if you want a fool-proof way that uses the account name specified by the user on login then you need to use the Access.log that FMS keeps (but is not turned on by default). There is a lot more work in parsing that but it has all the details you need. I've shown how to do this about 7-8 devcons ago. Grab a copy of the access.log and learn how to parse it.
Recommended Posts
This topic is 3911 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now