Jump to content

RunShellScript via FM Server - Who am I?


Opotoc
 Share

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

Recommended Posts

Hi guys,

I run some automatic imports directly via FileMaker Server's documents folder, works fine.

I'm trying to remove the files imported afterwards.

But a simple RunShellScript (rm $filepath) doesn't do the job.

So I'm wondering if I run a shell script via FM Server, which user will actually execute the command?

It's not the logged in user in the system nor the fmsadmin,

otherwise the file should be removed since both have access to the FMS Documents folder.

Best,

Alexander

System MAC OS 10.6.6 Server

FMSA 11

Link to comment
Share on other sites

I'm not the best with Mac shell scripts, but I think this (or something like it), would save the output of whoami to a text file. Just make sure the path you are saving it to can be written to by any users.

whoami > "/whoami.txt"

Link to comment
Share on other sites

cool hint :-)

in the terminal this works fine but using Scriptmaster with the FMServer or a FMClient I doesn't work at all, very strange...

even a simple

RunShellScript( "echo \"hello\" > /Volumes" & Get ( TempPath ) & "whoami.txt" )

doesn't work.

In the Mac terminal it works fine..

Link to comment
Share on other sites

That's too bad. I'm surprised that didn't work; especially since it works when running directly from the shell.

Maybe the shell command is not formatted properly? Meaning, by the time it is actually processed by the shell and all string's are concatenated, and quotes escaped, the command is not valid? Perhaps you could use ScriptMasters output variables section in the bottom-left of the screen to output the value of the text string that is being sent to the shell.

Link to comment
Share on other sites

cool hint :-)

in the terminal this works fine but using Scriptmaster with the FMServer or a FMClient I doesn't work at all, very strange...

even a simple

RunShellScript( "echo \"hello\" > /Volumes" & Get ( TempPath ) & "whoami.txt" )

doesn't work.

In the Mac terminal it works fine..

Would be better with single quote don't you think:

RunShellScript( "echo 'hello' > /Volumes" & Get ( TempPath ) & "whoami.txt" )

Link to comment
Share on other sites

  • 1 year later...
  • Newbies

Just tested this on a Lion server.

I let my script send me an E-Mail with the result of the RunExecuteShell command.

I always only get this a result in the E-Mail:

Executed shell command: <here follows the shell command SM was supposed to execute>.

This seems to be a bug.

Link to comment
Share on other sites

Just tested this on a Lion server.

I let my script send me an E-Mail with the result of the RunExecuteShell command.

I always only get this a result in the E-Mail:

Executed shell command: <here follows the shell command SM was supposed to execute>.

This seems to be a bug.

Did you use RunShellScript() from an old example or the newer version RunShellScript ( command ; waitForOutput ; timeout )?

The new one definitely works much better for me.

Grüsse ausm Süden,

Alexander

Link to comment
Share on other sites

  • 1 month later...
  • Newbies

Did you use RunShellScript() from an old example or the newer version RunShellScript ( command ; waitForOutput ; timeout )?

The new one definitely works much better for me.

Grüsse ausm Süden,

Alexander

I did use the the newest version

Grüße aus Berlin

M

Link to comment
Share on other sites

This topic is 3863 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.