Skip to main content
Solved

Correct syntax for SystemCaller?


aron
Supporter
Forum|alt.badge.img+16
  • Supporter

(This is a spin of question from https://community.safe.com/s/feed/0D5OO000004YH4O0AW, but I thought it made sense to rephrase the question)

 

I am trying to run a shell script from SystemCaller but for some weird reason I can not make it work. 

 

My command line is: 

cd "/Volumes/disc1/test_systemcaller/" && my_script.sh 25 5

The numbers at the end are parameters for the script.

 

The error I get from the log file is:

sh: my_script.sh: command not found

The file 'my_script.sh' is placed in the actual folder, so should be found.

If I test the file path by asking it to do something simple, eg mkdir, it will happily do so in the right place.

If I run the command from Terminal it works fine. 

 

I made a second script in the folder with a mkdir just for testing. While it works fine in Terminal, FME claims to know nothing about it.

 

Since system caller cant find the script file, even though it is in the folder, I guess that something might be wrong with my syntax? I'm on a Mac if that matters. 

Best answer by aron

And here is the final solution in case someone else runs into similar issues in the future. 

export PATH=/opt/homebrew/bin:$PATH && cd "/Volumes/disc1/test_systemcaller/" && ./my_script.sh 25 5

'export PATH=/opt/homebrew/bin:$PATH' was needed because the gdal programs called in the script could not be found otherwise. No problems running them without any path referencing from Terminal, but something goes astray within the SystemCaller.

View original
Did this help you find an answer to your question?

5 replies

hkingsbury
Celebrity
Forum|alt.badge.img+54
  • Celebrity
  • January 23, 2024

I'm taking a stab here that the script might not be executable...

you can make it executable by going to the dir and running. This might need to be done with sudo

chmod +x my_script.sh

Alternately, you could try

    cd "/Volumes/disc1/test_systemcaller/" && sh my_script.sh 25 5

or

    sh "/Volumes/disc1/test_systemcaller/my_script.sh" 25 5

 

I don't have an osx machine right in front of me atm to confirm (currently at work, personal machine is osx) hopefully one of these will work....

 


aron
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • January 24, 2024

Thanks, you gave me some new ideas. I finally got it running with:

    cd "/Volumes/disc1/test_systemcaller/" && ./my_script.sh 25 5

'./' should not be needed, but it did. 


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
aron wrote:

Thanks, you gave me some new ideas. I finally got it running with:

    cd "/Volumes/disc1/test_systemcaller/" && ./my_script.sh 25 5

'./' should not be needed, but it did. 

Ahh yeah, the ol' "./" thing - nice


danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • January 25, 2024
hkingsbury wrote:

I'm taking a stab here that the script might not be executable...

you can make it executable by going to the dir and running. This might need to be done with sudo

chmod +x my_script.sh

Alternately, you could try

    cd "/Volumes/disc1/test_systemcaller/" && sh my_script.sh 25 5

or

    sh "/Volumes/disc1/test_systemcaller/my_script.sh" 25 5

 

I don't have an osx machine right in front of me atm to confirm (currently at work, personal machine is osx) hopefully one of these will work....

 

Great solution !


aron
Supporter
Forum|alt.badge.img+16
  • Author
  • Supporter
  • Best Answer
  • January 25, 2024

And here is the final solution in case someone else runs into similar issues in the future. 

export PATH=/opt/homebrew/bin:$PATH && cd "/Volumes/disc1/test_systemcaller/" && ./my_script.sh 25 5

'export PATH=/opt/homebrew/bin:$PATH' was needed because the gdal programs called in the script could not be found otherwise. No problems running them without any path referencing from Terminal, but something goes astray within the SystemCaller.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings