HOW TO: Auto start Servoy Server on Mac OS X

Create a text file called “servoy_server.sh” and place it in your Servoy applications directory.

The following code is from Marcel Trapman.

#!/bin/sh 

 cd /Applications/Servoy 
 export DYLD_LIBRARY_PATH=/Applications/Servoy/sybase_db 
 /Applications/Servoy/sybase_db/dbsrv9 @/Applications/Servoy/sybase_db/sybase.config & 

 while true 
 do 
     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 "$@" 
     EXITCODE=$? 
     if [ "$EXITCODE" != 99 ]; then exit $EXITCODE; fi 
 done


 sybase.config (in /Applications/<servoy folder>/sybase_db/

In the Startup items for this account (SystemPreferences/Accounts/AccountName) call for this shell script.

That’s it.

I’ve seen reports on Servoy Talk about having difficulties getting Sybase to start. With the above script and method on an Xserve I’m not having issues.

I tried and utterly failed on this particular Xserve to use Apple’s recommended method for auto starting a service – create a StartupItems directory in the root Library, clone an existing startup from /System/Library/StartupItems, edit the startup file and the plist. Many attempts with recommendations from several knowledgeable Servoy and Mac consultants all failed. In the end logging in as a particular user and having that user auto start the shell works.

Kind regards,

This method requires a user to be logged in. This is not what you usually want on a server, if you don’t want to call it dangerous. Since I played a little bit with the Mac myself and haven’t been fully sucessful either: maybe someone out there could post an indiot proof way to do this? Or the Servoy installer might be able to do this or provide the necessary files in a folder inside the Servoy folder? :)

True it does require a user to be logged in. On my Xserve since that user does not have OS admin privileges it’s my assumption this is reasonably secure.

I’ve spent two-and-half weeks, several consultations with professional Mac and Unix consultants and numerous eMails with Robert Ivens (who posted Marcel Trapman’s original methodology), all without success, I felt a great sigh of relief earlier today in getting Servoy Server finally to launch as a service on a Mac. I’ve been told it should be easy, but no recommendation has ever actually worked. Getting this particular Xserve to launch Servoy Server as a service has been like watching a cat chase its tail.

In what way is this methodology dangerous?

Kind regards,