While CFMX 6/7 Server Configuration on Unix and Linux ships with boot scripts that upon system reboot will kick off ColdFusion automatically, this feature is not a part of CFMX 6.1 for JRun or CFMX 7 Multiserver configurations.

I've written and tested these boot scripts that will start ColdFusion 6.1 or 7 on Red Hat Enterprise Linux 3 and 4 at system boot when using either the JRun/Multiserver configuration or an EAR/WAR configuration for JRun.

Once installed to the system, root user can use the service command to start the ColdFusion instance from anywhere on the system without having to cd to /etc/init.d/ or to $JRUN_HOME/bin.

The example boot scripts can be used as a starting point. To use it:

  • make a copy of one of the boot scripts from the download archive, rename it to something meaningful like jruncfmx7ear to reflect the purpose of the script,
  • move it to /etc/init.d/ directory, (this should already have the executable bit set for root, but if not then chmod the file to 700)
  • edit the script using vi or another text editor,
  • note the area intended for CUSTOMIZATIONS and edit the parameters as described by the comments, such as $JRUN_INSTANCE=cfusion to indicate that the instance name you would like the script to start is cfusion,
  • then use chkconfig to officially register the script to start or stop at certain run levels, for example
    chkconfig --add jruncfmx7ear which will set the script to run in runlevels 2, 3, 4, and 5 or to specify particular run levels use chkconfig --levels 3 to have the script run when entering only runlevel 3, which is the default run level for a server OS not having X Windows.
  • To check how the script is configured, use chkconfig --list jruncfmx7ear in this case.
  • If you have multiple CF/JRun instances, you can have one of these scripts per instance so that each one is controlled indendently.


Here's an example from the script that you should modify to match how the instance of ColdFusion is configured on JRun:
#------- CUSTOMIZE HERE ---------------
#
#change the following few settings as needed
RUNTIME_USER=""nobody""
JAVA_HOME="/opt/jrun4/jre"
JAVA_EXECUTABLE="/opt/jrun4/jre/bin/java"
#
#change JRun instance name here
#original multiserver cfmx will be "cfusion"
JRUN_INSTANCE="cfusion"
#
#change JRun root directory here
JRUN_DIR="/opt/jrun4"
#
#change ColdFusion war or ear location here.
#for example look in $JRUN_INSTANCE... what do you see?
#original multiserver will be "cfusion-ear/cfusion-war",
#but if you create new instance and deploy cf as war,
#will be "cfusion-war" if you extracted cfusion.war into cfusion-war directory
#CFMX_ARCHIVE="cfusion-war"
CFMX_ARCHIVE="cfusion-ear/cfusion-war"
#
#these should be ok as is so don't change
DOCROOT="${JRUN_DIR}/servers/${JRUN_INSTANCE}/${CFMX_ARCHIVE}"
CF_DIR="${JRUN_DIR}/servers/${JRUN_INSTANCE}/${CFMX_ARCHIVE}/WEB-INF/cfusion"
#------- END CUSTOMIZATION -----------


And here is an example of calling the service command from root's home directory to start and stop the cfusion instance that is default with CFMX 7 Multiserver:
[root@Aneto ~]# service jruncfmx7multi start
Starting ColdFusion MX server instance cfusion on JRun ...
The ColdFusion MX server instance cfusion on JRun is starting up and will be available shortly.
======================================================================
ColdFusion MX server instance cfusion on JRun has been started.
ColdFusion MX server instance cfusion on JRun will write logs to
/opt/jrun4/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/logs/cfserver.log
======================================================================
[root@Aneto ~]# service jruncfmx7multi stop
Stopping ColdFusion MX server instance cfusion on JRun, please wait
Stopping cfusion server..stopped
ColdFusion MX server instance cfusion on JRun has been stopped
[root@Aneto ~]#


Finally, here's output from /var/log/messages that demonstrates three types of ColdFusion instances started on a system reboot:
[root@Aneto ~]# tail -500 /var/log/messages | grep jrun | grep succeed
Jul 15 15:31:31 Aneto rc: Starting jruncfmx61war: succeeded
Jul 15 15:31:44 Aneto rc: Starting jruncfmx7multi: succeeded
Jul 15 15:31:57 Aneto rc: Starting jruncfmx7war: succeeded
[root@Aneto ~]#


These scripts are currently provided as is, without warranty. Use at your own risk. I have opened a bug report to get boot scripts added to these types of ColdFusion configurations during the installation, and these boot scripts are provided as experimental only, but I have tested them thoroughly on Linux and they work well for me. Frankly, I'm not sure how to add boot scripts on Solaris, but I speculate that these will work well there, too, once I figure that out.