Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • Newbies

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

Use a free plugin like the BaseElements plugin and enable your server to use it.

  • Author
  • Newbies

Thanks Wim; I'll look into that now!

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.  

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.

  • Author
  • Newbies

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

 

 

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.