Post categories



Recommended Wordpress Hosting from WPEngine

  • I use these guys for some of my clients; absolutely rock solid and blazingly fast - check them out!





Here are a couple of ads whose clicks and views help me pay for my server hosting











Quick howto: init.d script for glassfish 3

Glassfish is a reference implentation of the Java EE 6 application server – it’s fairly easy to download and get running, but I wanted to get it running automatically on system startup on my linux server (which at the moment is running on coLinux – probably post about separately that at some point).

I’m assuming you’ve got the glassfish .zip, and extracted it to /opt/glassfishv3… and you’re running a debian-based OS (like Debian Lenny, or Ubuntu). These commands assume you’re either running as root, or prepend all of them with sudo…

Create a file:

/etc/init.d/glassfish.sh

and put the following in it:

GLASSFISH_HOME=${GLASSFISH_HOME:-"/opt/glassfishv3/glassfish"}
case "$1" in
start)
    $GLASSFISH_HOME/bin/asadmin start-domain | tee -a /var/log/glassfish.log
    ;;
stop)
    $GLASSFISH_HOME/bin/asadmin stop-domain | tee -a /var/log/glassfish.log
    ;;
restart)
    $GLASSFISH_HOME/bin/asadmin restart-domain | tee -a /var/log/glassfish.log
    ;;
*)
echo "usage: $0 (start|stop|restart|help)"
esac

Make sure it’s executable:

chmod +x /etc/init.d/glassfish.sh

Make it start by default on system boot:
update-rc.d glassfish.sh defaults

Then start your glassfish server 🙂 if it doesn’t appear to be working, you can tail the logs:

tail -F /var/log/glassfish.log

Done! Easy as pie 🙂

(thanks to http://bit.ly/qZ4fTj)