Hi
I have what I think is a permissions issue, perhaps some of those more experienced with this function may be able to clarify:
I want to run a bash script which interfaces with imagemagick and fonts on the server. The script can be triggered fine manually from the home directory and all works OK
I have created a simple web-client based admin for the client and I want him to be able to trigger the script from a button. As far as I can tell this should be triggered locally and should call the script from the hone directory as per the path shown here. Is this the case or do I need to run this from within the servoy server and if so where should it be located ?
I am getting a permission denied which I guess could be the web client element, is there any way to set the permissions in the script above ie sudo or similar
The shell script will be run under the same system user that Servoy server is run under. Does that user have permissions to do what it tries to do?
I.e. when you running it from the command line yourself are you using the same system user?
To be fair Patrick suggested that and the short answer is I am not sure. I have been testing this in my developer version so Servoy is installed as developer in the normal way so I am guessing they are the same thing. Is there a way to check what user Servoy is using I am not sure ?
OK I just typed top -o size into terminal and Servoy is running under user gordonmclean so I guess that is not the problem as terminal is using the same user
I have a perl script that does a load of ImageMagick processing for a website based on user inputs. The admin for the site is Servoy and the site its self if going to be run via Velocity. The specific problem here is the guy wants to upload fonts to the server periodically and these are displayed as an image of the font name.
I want trying to get the admin to upload the font then run a bash script to install it on the server. IF Servoy could process the ImageMagick stuff that would be perfect I just could not figure out how to make that work
Hi
The specific problem is the bash.sh script is not run by the function:
application.executeProgram(“./”,[“/Applications/Servoy_7_General/application_server/server/webapps/bash.sh”])
The bash.sh script is enabled and neither works on my desktop or in the Servoy folder. HOWEVER if I run the script in either location from the terminal it works fine.
Your use of ImageMagick is very interesting thank you for sharing. I need the bash script to work simply to enable the font on the server, I may be able to find an alternative approach if I can’t get the bash script to trigger from servoy.
// returns result!
application.output(application.executeProgram('/usr/bin/env'));
// no result, not even writing a file...
application.output(application.executeProgram('/bin/sh', ['/Users/robert/test.sh']));
When I try to run a shell script this indeed doesn’t work. So it seems there is something different when you run a shell script vs a program.
I finally found a solution to this so for those who may also want to trigger a server side bash script this is the solution. The caveat to this is be careful what your doing and aware of the security risks this could present
What this does is to effectively make the bash.sh into an application called in this case myscriptname. Hereafter you can simply type myscriptname into the terminal and it will trigger the script. This enabled Servoy to call the script with application.executeProgram(“/usr/sbin/myscriptname”) - (this is on the Mac)
I intend to use this on a Linux server and it works in much the same way, but for testing purposes the above was required.
To reiterate the caveat, Apple put the system integrity check in place for a good reason and disabling this needs to be done with caution, and remember to re enable it. Be careful exposing bash scripts in this way generally, and make sure they do exactly what you want before you attempt adding them to Servoy. Finally there may have been very good reasons why Servoy restricted this feature that I am unaware of and taking their advice may be prudent.
I still do not understand why you had to disable SIP. Could you not link that script into /usr/local which is not protected by SIP?
That’s where homebrew puts its CELLAR folder for kegs
No the finder refused to allow me to add a script into this folder and make it executable. However with the SIP removed temporarily it had no problem, I believe this was instigated with Mavericks. Not sure how home-brew do as you say many other installers seem to get around this. I did try with sudo so it should have had root privileges. None the less having got it working it does open up a whole new range of potential server side functions you can do from within Servoy which great for your own local admin if nothing else.
Robert did a better explanation but of the same thing
// returns result!
application.output(application.executeProgram('/usr/bin/env'));
// no result, not even writing a file...
application.output(application.executeProgram('/bin/sh', ['/Users/robert/test.sh']));
The key points being
a) Servoy would not run the bash script direct - that would be ideal
b) I could not add the symlink into /usr/bin I had to first remove the block. I could have written the the bash into usr/bin but wanted to keep the client files separate.
I guess they (apple) are trying to prevents you writing some script into a folder and throwing a symlink into the bin to trigger system wide scripts remotely or something …