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.

Get Value from System-Level Script

Featured Replies

I've got an IP thermostat and I'd like to regularly pull the temp using SNMP and insert it into a FileMaker database.  I've got a bash script that returns the temp but I can't figure out how to get that data into FileMaker.

I've got a script sequence which runs the bash script and then runs a FileMaker script.  I was hoping get(scriptparameter) would read the output from the run before script, but it doesn't work.

Do I have to write the temp out to a file and then import it or is there a better way?

Thanks,

Isaac

make the bash script spit out something to the FMS documents folder and have your FM script part of the schedule import from that.

2 hours ago, Isaac Knoflicek said:

I've got a bash script that returns the temp but I can't figure out how to get that data into FileMaker.

What triggers this script? And what is your system: OS, FM version?

Bash = OSX and OP mentioned that the script is triggered through a server-side script sequence schedule

  • Author

I'm not married to any way of executing the script.  I was hoping I could just have FileMaker Server execute it through it's scheduler and pull the results in at the same time.

If that's not possible what @Wim Decorte suggested should also work, just having Cron run the script and dump the output to a .csv which FM picks up.  A little less elegant, but functional.

Thanks!

Isaac

The FMS script sequence schedule is the better approach (with dumping the output of the bash script in the FMS docs folder).  Mainly because the bash script can prevent the FM script part from running by exiting with a non-zero result.

If you use Execute AppleScript, you can easily run a Bash script, and if the bash script exits with a result you can capture it using Get(ScriptResult) inside FileMaker.

Do something like this:

Script GetMyTemperature

Perform AppleScript

"tell application \"Finder\"¶" &
"  set cmd to \"/path/to/my/bash/script.sh" & ¶ &
"  set theResult to do shell script cmd¶"  &
"  return theResult¶"  &
"end tell"

 

set variable $result = Get(LastError)

Exit Script [Result: $result]

 

 

"Perform AppleScript" is not a server-compatible script step...

6 hours ago, Wim Decorte said:

"Perform AppleScript" is not a server-compatible script step...

Oops, right. 


For server use on OS X, there are some custom plugins out there which allow you to make a Shell call.  I wrote my own but they are pretty easy to find, and some of them are free.

You could trigger a php script with your bash script... I guess...

Or even start with a php script using exec () and forgo the bash script if you can live with having php exec allowed on the server.

Edited by Buckie

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.