We distribute our application as tar.gz on Linux.
Our server is actually jetty with our web application, but we want to make some checks before the server start in order to provide clear error messages w/o need for a user to scan log files. So I wrote the server start script in groovy and packed groovy installation (and JRE as well) into the application distribution.
The problem was, however, that groovy script can't run by itself (like shell script), so I wrapped the script into the shell script.
Assuming that our installation looks like
the shell script "myscript" will looks like:
server_bindir=`(cd $server_bindir;pwd)`; #get absolute path
$install_home/groovy/bin/groovy -cp $server_lib_dir:$jars_dir/myjar.jar $server_lib_dir/myscript.groovy $*