February 29, 20169 yr 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
February 29, 20169 yr make the bash script spit out something to the FMS documents folder and have your FM script part of the schedule import from that.
February 29, 20169 yr 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?
February 29, 20169 yr Bash = OSX and OP mentioned that the script is triggered through a server-side script sequence schedule
February 29, 20169 yr 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
February 29, 20169 yr 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.
March 6, 20169 yr 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]
March 6, 20169 yr 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.
March 7, 20169 yr 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, 20169 yr by Buckie
Create an account or sign in to comment