Isaac Knoflicek Posted February 29, 2016 Posted February 29, 2016 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
Wim Decorte Posted February 29, 2016 Posted February 29, 2016 make the bash script spit out something to the FMS documents folder and have your FM script part of the schedule import from that.
comment Posted February 29, 2016 Posted February 29, 2016 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?
Wim Decorte Posted February 29, 2016 Posted February 29, 2016 Bash = OSX and OP mentioned that the script is triggered through a server-side script sequence schedule
Isaac Knoflicek Posted February 29, 2016 Author Posted February 29, 2016 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
Wim Decorte Posted February 29, 2016 Posted February 29, 2016 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.
xochi Posted March 6, 2016 Posted March 6, 2016 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]
Wim Decorte Posted March 6, 2016 Posted March 6, 2016 "Perform AppleScript" is not a server-compatible script step...
xochi Posted March 6, 2016 Posted March 6, 2016 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.
Buckie Posted March 7, 2016 Posted March 7, 2016 (edited) 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 March 7, 2016 by Buckie
Recommended Posts
This topic is 3456 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