Jump to content

Shell script invalid command


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

Recommended Posts

Please help me with this (small) problem. New to doing shell scripts so sure it's something small

Created a shell script and saved it (myfile.sh) in scripts folder. Fixed r/w privileges to fmserver.

One line only in myfile.sh: curl http://123.123.123.123/myfolder/sendemail.php

FMS returns a invalid command error.

If I run it in Terminal it works fine.

What am I missing?

Thanks,

Marco

Link to comment
Share on other sites

Fixed the execute but still same error...

2011-02-07 08:11:31.114 +0100 Error 154 BLOOM FMS 10 Schedule "Newsletter Shellscript" aborted; "sendnewsletter.sh" could not be found or is invalid.

The php sends emails to selected addresses.

Don't understand what you're saying if the server is same box..

Thanks for your help.

Link to comment
Share on other sites

2011-02-07 08:11:31.114 +0100 Error 154 BLOOM FMS 10 Schedule "Newsletter Shellscript" aborted; "sendnewsletter.sh" could not be found or is invalid.

Don't understand what you're saying if the server is same box..

The curl command in your shell script targets an IP address. And since your example didn't use "localhost" or "127.0.0.1" I was asking if the PHP file is on the same box as FMS or on a different box. If it's on a different box, it could be an access privileges issue. The "fmserver" account that drives FMS may not have permissions to touch that file on the remote machine whereas your account does. Which would explain why it runs while you are logged in but not when FMS executes it.

"sendnewsletter.sh" could not be found or is invalid.

This does look however like the permissions on the shell script itself are not correct. Set "fmserver" as the owner, "fmsadmin" as the group.

Link to comment
Share on other sites

@ Wim

File is on same machine. Changed ip to localhost. No change.

Also changed the shell command no nothing. Same error.

I'm sure you're right it has to do with ownership. Changed it to fmserver and fmsadmin. No change. Cant adjust privileges now (-142 chmod failure). What does that indicate?

I work in Coda. If I create new file in script folder it has no ownership or privileges. I can't adjust ownership. I can adjust privileges.

How do I create a 'fresh' file? So that I'm sure all settings are correct?

Thanks for your help!

Link to comment
Share on other sites

Don't know Coda, but just create a new blank text file using text edit and copy/paste the shell script code into that new file. Change the extension to .sh, use Batchmod to set the ownership and group plus the rwx privileges and try to run it manually. If that works, move it into the FMS scripts folder and try with a schedule.

Link to comment
Share on other sites

I doubt it. It sounds more like FMS has trouble executing the file.

But to make sure: can you replace the shell script (use the same name though) with one that just creates a little text file in the FMS documents folder (FMS has rights to that). That way we would know if the file actually executes. If it does, then it is the code in the shell script that doesn't work.

Link to comment
Share on other sites

  • 2 weeks later...

This topic is 4803 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
×
×
  • Create New...

Important Information

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