Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3060 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I'm trying to execute a windows cmd script server-side from client machines. I've got this working locally using Send Event, but I found that this command isn't compatible with server schedules, which I believe would be the best way to do this in conjunction with a flag. The specifics of the script I'm wanting to deploy are:

We use Google Apps for our user accounts, of which we have thousands. We currently use Google Apps Manager, a cmd tool for making remote changes to accounts and other aspects of Google apps, on a linux server as part of an automated workflow that is triggered by Filemaker/ODBC etc. However, occasionally the process trips up, or a user needs changes to be made to their account so I'm wanting to create an interface in Filemaker that the team can use to execute a server-side script that performs actions on a record-by-record basis. E.g., one of the script steps is

Send Event [""; "aevt"; "odoc"; "cmd.exe /c gam create user " & Enrolled Courses::Gmail & " firstname " & Contact Details::First Name &" lastname " & Contact Details::Last Name & " password " & Enrolled Courses::Password]

 - this works when run locally on the server, but not from clients due (I presume) to the Send Event step.

We can't install the command line tool on each of the client machines due to security implications, and also because they're a mix of macs & PCs and the server is Windows, so I really need to be able to execute the cmd.exe server-side (although there is a Python flavour of the tool, if that opens up any options). If there any way to do this that also allows passing the required variables?

 

Many thanks in advance.

 

Paul

Posted

I'm using the BaseElements plugins for several different server-sided transactions.  It's a great tool for that purpose.  But I do have to give a warning - with the major potential issues this can cause, please test you code thoroughly before putting it into production.  

Posted

Create logs. Because these are serverside scripts, you can't test it using the debugger. Create a batchfile that outputs all it's output to a logfile (make sure you append and not overwrite each new call to the script) so that you can trace what happened and where it went wrong. Echo information to the logfile like the userdetails and timestamps. Do checks such as whether files or folders exists that are needed. Echo results to the logfile of each test. If you create a folder in the batchfile, test afterwards if it exists, and report the result in the logfile.

When invoking recurring scripts (ie every 15 minutes) use a flag (ie a field in a table for the purpose with just one record) to indicate the script is running so that when the next runtime arrives, the script isn't invoked again if it is still running.

In your FMS script, if you loop through records and invoke a cmd script for each record, have an option to stop the loop from a client (ie check a field in the same table to see if it is true or false or whatever).

BaseElements is generally invoked using a variable and all cmd output that is not send to NUL is captured in that variable. Output from commands in the batchfile is too. You can store that in a FM table as well.

I'm running quite a few scripts on the server using BE and have no issues. I do have lots of logfiles. Make sure you clean up those logfiles too after a while (automated), and don't store them on the C: drive.

  • Newbies
Posted

Thanks all for the comments! I'm using flags for a separate scheduled job that utilises the php api, so I've got that side working, and will look at setting up a log file for debugging. I'm currently investigating BE on a dev server so hopefully from what you're all saying, that will solve this issue for me.

 

Many thanks again!

 

Cheers,

Paul

 

 

This topic is 3060 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.