Starting DB2 instances on boot

After migrating our hosted application to a virtual server I realized, that as usual the system is a “maintenance free” Linux, meaning we set it up as it were and left it running for ages without touching it. On the occasion of power failure the applications were started manually.

As I don’t want to restart everything by hand, whenever our system is restarted I decided to iron these glitches out. OK, the system is only restarted about twice a year, but I tend to forget to restart things manually, so that’s the real reason.

The hosted application runs on a WebSphere Application Server Community Edtition 2.0 (meaning an IBM branded Apache Geronimo 2.0) which had an init script hacked together from an init script originally for Apache Tomcat. Talking about code reuse is one thing, doing it is another. It had a few quirks, like the JAVA_HOME setup, that were easily ironed.

The application stores it’s data in an IBM DB2 Universal Database 9.5, which performs beautifully by the way. It’s running on Debian, and was installed using the factory installer, which created the startup scripts as well. However the DB2 instances are not automatically started, and that’s a problem.

I was going to write a startup script which starts the db using the instance user, but it turned out it’s easier than that. DB2 instances can be auto started, only they are not created that way. Changing the flag is easy, as documented here, you just have to issue the db2auto command for the instance.

The only thing left is to add some script to auto start the VirtualBox instance, and preferably stop it as well on shutdown.

Leave a Reply

Your email address will not be published. Required fields are marked *