Home > ColdFusion, Linux > Automatically start ColdFusion at boot on Ubuntu Linux (but not 8.04)

Automatically start ColdFusion at boot on Ubuntu Linux (but not 8.04)


Quite a few months ago I did a blog post about starting ColdFusion on boot with Ubuntu Linux. When I originally wrote the post I did put a disclaimer on there that I was indeed new to Linux and there was probably a better way to do what I was attempting to do. I was right.

There is a very easy way to accomplish this in three steps and it does not require editing your system files or going through all the run levels and trying to figure out where to start and stop ColdFusion.

The first thing you need to do is make sure the chkconfig utility is installed on your system. I do not believe it is installed by default on Ubuntu distributions, but that is easy enough to remedy:

sudo apt-get install chkconfig

Next we need to copy our generated coldfusion script to /etc/init.d:

sudo cp /opt/coldfusionX/bin/coldfusion /etc/init.d

At the top of the file ColdFusion made for us are some special directives for the chkconfig utility. Chkconfig will look for these and automatically set where ColdFusion needs to be stopped and started. It looks something like this:

#!/bin/sh

# chkconfig: 345 90 14
# description: starts the ColdFusion MX server

Finally, run the chkconfig utility to add ColdFusion service to the list of services run at boot:

sudo chkconfig --add coldfusion

Enjoy.

I was later informed that these instructions do not work on Ubuntu 8.04.  A user found a way around the issue:

Found it and it works!

Create a link to coldfusion in the init.d folder:

sudo ln -s /opt/coldfusion8/bin/coldfusion /etc/init.d/coldfusion

Run update-rc.d:

sudo update-rc.d coldfusion defaults

Easy-Peasy! Even if I have no idea what running update-rc.d actually does…

Categories: ColdFusion, Linux
  1. November 14, 2009 at 3:03 pm | #1

    I’m working on setting up a VM with CF9 on Ubuntu and I simply added the CF9 startup to /etc/rc.local:

    ./opt/coldfusion9/bin/coldfusion start

  2. John di Stefano
    January 16, 2010 at 2:06 pm | #2

    Jim Priest :
    I’m working on setting up a VM with CF9 on Ubuntu and I simply added the CF9 startup to /etc/rc.local:
    ./opt/coldfusion9/bin/coldfusion start

    That might work if you have that file …….

    • John di Stefano
      January 17, 2010 at 9:32 am | #3

      I tried it with cf9 and it didn’t work.
      I then used your part fort 8.04 and it worked a treat.

      Thanks

  3. brian
    November 14, 2010 at 10:30 pm | #4

    dont forget
    sudo chmod +x /etc/init.d/coldfusion

  4. April 7, 2011 at 9:26 pm | #5

    On the latest versions of Ubuntu and Debian, you have to use update-rc.d which serves the same function as chkconfig using a different configuration.

    This requires to modify the coldfusion script (the sed command bellow), for more info, checkout:
    http://wiki.debian.org/LSBInitScripts

    The commands (as root) and output is:
    # ln -s /opt/coldfusion9/bin/coldfusion /etc/init.d/coldfusion
    # sed -i -f – /etc/init.d/coldfusion < ../init.d/coldfusion
    /etc/rc1.d/K20coldfusion -> ../init.d/coldfusion
    /etc/rc6.d/K20coldfusion -> ../init.d/coldfusion
    /etc/rc2.d/S20coldfusion -> ../init.d/coldfusion
    /etc/rc3.d/S20coldfusion -> ../init.d/coldfusion
    /etc/rc4.d/S20coldfusion -> ../init.d/coldfusion
    /etc/rc5.d/S20coldfusion -> ../init.d/coldfusion

  5. April 7, 2011 at 9:33 pm | #6

    My sed command and the beginning of update-rc.d, have been swallowed. Anyway, you need to insert after line 1 for the coldfusion startup script the following lines (using sed or your preferred interactive editor):

    ### BEGIN INIT INFO
    # Provides: coldfusion
    # Required-Start: apache2 mysql
    # Required-Stop: apache2 mysql
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Starts Coldfusion at boot time
    # Description: ColdFusion Server
    ### END INIT INFO

    Then you need to run update-rc.d:
    # update-rc.d coldfusion defaults
    Adding system startup for /etc/init.d/coldfusion …
    /etc/rc0.d/K20coldfusion -> ../init.d/coldfusion
    /etc/rc1.d/K20coldfusion -> ../init.d/coldfusion
    /etc/rc6.d/K20coldfusion -> ../init.d/coldfusion
    /etc/rc2.d/S20coldfusion -> ../init.d/coldfusion
    /etc/rc3.d/S20coldfusion -> ../init.d/coldfusion
    /etc/rc4.d/S20coldfusion -> ../init.d/coldfusion
    /etc/rc5.d/S20coldfusion -> ../init.d/coldfusion

    • April 7, 2011 at 11:49 pm | #7

      Thank you for the update! I appreciate it and I am sure others will as well.

  6. February 24, 2012 at 11:09 pm | #8

    Many Thanks for providing easy solution! Great job!

  7. May 26, 2012 at 2:32 pm | #9

    A debt of thanks from me to you — your wisdom prevailed after several other approaches failed.

    THANK YOU!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 364 other followers