Startup Shell script

On reading the manual for installation, it tells me to ‘Add this shell script to your startup files servoy_server.sh’

Can anyone tell me how I go about doing this, and where are the startup files.

Thanks

What are you trying to do? Have your server starting up with servoy_server?

What platform are you running on?

Please be a more specific…

Sorry, you are right, I should have been more specific.

Yes, I want Servoy Server to startup automatically when the machine restarts.

We are using an Xserve, running Mac OSX 10.3

I don’t know how to do this exactly (if you found it please let me know) but the startup items are in library/startupitems…

Will let you know when I find out.

By the way, I don’t have startupitems folder anywhere?

Whoops, yes I have. In the System/Library

I have the same problem.

The Server documentation assumes you know how to write a startupitem and get it to run when the computer starts up. This may be a doodle if are used to unix and writing shell-scripts.

I found an article with an example startup item on macdevcenter.com, what would I need to change?

It would very helpful if someone could post a modified version of the script and plist for Servoy. :D

Could there be an option on the installer to sort this out when installing?

I haven’t tried, but creating a simple applescript like
tell application “Finder”
do shell script “Yourdisk/Applications/Servoy/servoy_server.sh”
end tell

Saving it as application and marking it as startup item in System Prefs doesn’t work?

Have tried this, but get error mesage from script:

Finder got an error: Exception in thread “main” java.lang.NoClassDefFoundError: com/servoy/j2db/server/ApplicationServer

I should also point out that I was unable to specify the ‘do shell script’ exactly as indicated as it couldn’t find the file, so I amended this command as follows:

do shell script “Applications/Servoy/servoy_server.sh”

i.e. by leaving off the ‘yourdisk’ part of the path, the script was able to find the file.

Any ideas?

Clive Sanders:
Exception in thread “main” java.lang.NoClassDefFoundError: com/servoy/j2db/server/ApplicationServer

I get the same error if I try to run the script manually in the terminal.
I’m on 2.0RC9, Mac OS X 10.3.3.

I also tried the modified “servoy_server.sh” posted elsewhere on this forum with no luck.

Starting from that article, I tried making my own startupitem, this is my “StartupParameters.plist”:

{
  Description     = "Servoy Server";
  Provides        = "Application Server";
  Requires        = "";
  Uses            = "";
  OrderPreference = "None";
}

And this is my “Servoy”:

#!/bin/sh

##
# Servoy
##

. /etc/rc.common

StartService ()
{
        ConsoleMessage "Starting Servoy server"
	/Applications/Servoy/servoy_server.sh
}

StopService ()
{
}

RestartService ()
{
}

I restarting the Mac a few times and tried accessing

http://192.168.0.2:8080/servoy-admin/

and get a message that there is nothing running on port 8080.

Obviously, everything works fine while running Servoy Developer.

can you try adding:

cd /Applications/Servoy

just before:

/Applications/Servoy/servoy_server.sh

Tried all of that, but still no joy. Servoy client cannot find repository.

but does the webserver run?

so do you have a page on:

http://localhost:8080/
and do you get a result when you do
http://localhost:8080/servoy.properties

jaleman:
can you try adding:

cd /Applications/Servoy

just before:

/Applications/Servoy/servoy_server.sh

Thanks. I modified a copy of “MySQL” so I now have a unix executable with the two lines above inside. My “Servoy” script now runs fine from the terminal and starts everything. But it still does not get run at startup.

Servoy

#! /bin/sh
#
# /Library/StartupItems/Servoy/Servoy
#
# A script to automatically start up Servoy on system bootup
#

cd /Applications/Servoy
/Applications/Servoy/servoy_server.sh

StartupParameters.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Description</key>
	<string>Servoy Server</string>
	<key>OrderPreference</key>
	<string>None</string>
	<key>Provides</key>
	<array>
		<string>Servoy Server</string>
	</array>
</dict>
</plist>

Any ideas?

If I do a http://localhost:8080/ on the server I get: Can’t connect to server. Could not connect to the server “localhost”.

Same result with http://localhost:8080/servoy.properties.

If I do http://192.168.1.50:8080/ or http://192.168.1.50:8080/servoy.properties from another PC on the network, I get ‘The page cannot be displayed’ (The IP address is the address of the server)

Try looking at the list of processes with the “Activity Monitor” application (it’s in the Utilities folder). If you have managed to start Servoy Server, there should be a bunch of processes called “gds_inet_server”.

No, there are no processes with these process names. If I start the Servoy Developer from another PC in my network, then yes I do see these processes.

Although I’m not the mac expert out here the following combination appears to work:

change servoy_server.sh into:

#!/bin/sh
cd /Applications/Servoy
/usr/bin/java -Djava.awt.headless=true -classpath .:lib/commons-collections.jar:lib/commons-dbcp.jar:lib/commons-pool.jar:lib/activation.jar:lib/antlr.jar:lib/j2db.jar:lib/j2dbdev.jar:lib/compat141.jar:lib/jh.jar:lib/jndi.jar:lib/js.jar:lib/jta.jar:lib/mail.jar:lib/jug.jar:lib/jdbc2_0-stdext.jar:lib/naming-common.jar:lib/naming-resources.jar:lib/servlet.jar:lib/xerces.jar:lib/server-bootstrap.jar:lib/commons-fileupload-1.0.jar:lib/commons-logging.jar:lib/hibernate2.jar com.servoy.j2db.server.ApplicationServer > server.log 2>&1

change Servoy in your startup items to:

#!/bin/sh

. /etc/rc.common

##

StartService ()
{
ConsoleMessage "Starting Servoy Application server"
su Servoy -c '/Applications/Servoy/servoy_server.sh' &
}

StopService()
{
ConsoleMessage "In the future Stop Servoy here"
}

RestartService ()
{
    StopService
    StartService
}

RunService "$1"

Although Apple says you don’t need to have anything in the StopService section mine refused to start without something in the StopService section.

NOTE the “su - Servoy” that I perform. Servoy is the username commonly used on our testing macs. Change it to the username that uses Servoy on your server.

It didn’t work when I tried copying your example, so
I borrowed a Unix geek for a few minutes :-)

We have it working now.

-we added the following to my .tcshrc

set path = ($path /Library/StartupItems/Servoy/)

-we made sure servoy_server.sh and Servoy are executable by doing

chmod +x servoy_server.sh
chmod +x Servoy

We also changed the ownership of Servoy to root.
Not sure whether this is all relevant, but the result works.

Next step is to move this onto the the remote server we are deploying on.

Glad to hear it works.

The settings you mention have all been taken care of in the script I posted so it troubles me a bit that my post didn’t work out.