Jump to content

Get Value from System-Level Script


Isaac Knoflicek
 Share

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

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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]

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

This topic is 2306 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
 Share

×
×
  • Create New...

Important Information

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