#!/bin/sh
JRUN_HOME="/home/jrun"
LOG_HOME="${JRUN_HOME}/logs"
if test x$1 = x
then
server=default
else
server=$1
fi
cd ${JRUN_HOME}/bin
./jrun -start ${server} \
1>$LOG_HOME/${server}-out.log 2>$LOG_HOME/${server}-err.log &
Adjust the second line to match the location of your JRun install (probably /Applications/JRun4). Save this shell script somewhere as cfmxstart and make sure it is executable:
JRUN_HOME="/home/jrun"
LOG_HOME="${JRUN_HOME}/logs"
if test x$1 = x
then
server=default
else
server=$1
fi
cd ${JRUN_HOME}/bin
./jrun -start ${server} \
1>$LOG_HOME/${server}-out.log 2>$LOG_HOME/${server}-err.log &
chmod +x cfmxstart
Now, from a Terminal window, you can start servers like this:
./cfmxstart
./cfmxstart blackstone
If you put the shell script on your PATH, you can omit the ./ part.
Here's a similar shell script to shutdown an instance:
./cfmxstart blackstone
#!/bin/sh
JRUN_HOME="/home/jrun"
if test x$1 = x
then
server=default
else
server=$1
fi
cd ${JRUN_HOME}/bin
./jrun -stop ${server}
Same drill, change line 2, save it as cfmxstop, make it executable.
Great, now what about doing this through a double-clickable Mac application? AppleScript to the rescue. Here's a simple AppleScript to run the shell script we just created:
JRUN_HOME="/home/jrun"
if test x$1 = x
then
server=default
else
server=$1
fi
cd ${JRUN_HOME}/bin
./jrun -stop ${server}
display dialog "Start which server instance?" default answer "default"
do shell script "/Users/scorfield/bin/cfmxstart " & text returned of the result
You'll need to change the path to the shell script, I keep all my utility scripts in ~/bin. When run, this pops up a dialog asking which server to start, enter the name and click OK and - bingo! - your shell script runs.
To create an application, select File > Save As... and then choose a file format of Application and check the Run Only checkbox and save it somewhere. Now you can drag the app to your dock for easy starting of CFMX.
If you want to get adventurous, you could add Stop and Start buttons to the dialog and run the appropriate shell script. You could also change the icon to something more CF-y of course.
Also, if you create AppleScripts that don't have dialogs, you can use them as Startup Items to cause your CFMX instances to startup whenever you boot up your Mac!
do shell script "/Users/scorfield/bin/cfmxstart " & text returned of the result
I couldn't resist... here's an AppleScript that lets you start and stop servers:
set scriptStem to "/Users/scorfield/bin/cfmx"
display dialog "Manage which server instance?" buttons {"Cancel", "Start", "Stop"} default answer "default"
set response to result
set operation to button returned of response
set serverName to text returned of response
if operation is "Start" then
do shell script scriptStem & "start " & serverName
else if operation is "Stop" then
do shell script scriptStem & "stop " & serverName
end if
display dialog "Manage which server instance?" buttons {"Cancel", "Start", "Stop"} default answer "default"
set response to result
set operation to button returned of response
set serverName to text returned of response
if operation is "Start" then
do shell script scriptStem & "start " & serverName
else if operation is "Stop" then
do shell script scriptStem & "stop " & serverName
end if

12 responses so far ↓
1 Andrew Muller // Dec 2, 2004 at 4:24 PM
2 Dick // Dec 3, 2004 at 4:47 AM
Anyone found out were Ken Ford has posted his install guide as Sean <a href="http://www.corfield.org/blog/index.cfm?do=blog.entry&entry=E0815F94-DFA6-5BC3-0C804776670DA850">blogged previously</a>?
3 Erki Esken // Dec 5, 2004 at 3:48 AM
Just run /Applications/JRun4/bin/jrun without any command line options and the JRun Launcher GUI appears.
4 Sean Corfield // Dec 5, 2004 at 2:23 PM
5 Erki Esken // Dec 6, 2004 at 1:50 AM
6 Sean Corfield // Dec 6, 2004 at 9:17 AM
JRun 4 Updater 4 fixes that problem by forcing a 1.4.2 JVM startup. The downside is that now you're exposed to the Apple AWT/Swing problem - which affects a lot of Java software with a graphical UI (including some Eclipse plugins).
7 chris kief // Feb 13, 2005 at 6:20 PM
java -jar /Applications/JRun4/lib/jrun.jar
java -jar /Applications/JRun4/lib/wsconfig.jar
8 chris kief // Feb 13, 2005 at 6:57 PM
#!/bin/sh
JRUN_HOME="/Applications/JRun4"
java -jar ${JRUN_HOME}/lib/jrun.jar
9 chris kief // Feb 13, 2005 at 7:04 PM
#!/bin/sh<br>
JRUN_HOME="/Applications/JRun4"<br>
java -jar ${JRUN_HOME}/lib/jrun.jar
10 chris kief // Feb 13, 2005 at 7:05 PM
set scriptStem to "/Users/ckief/desktop/mindflood/cfmx/"
do shell script scriptStem & "startjrunlauncher"
11 chris kief // Feb 13, 2005 at 7:06 PM
chmod +x startjrunlauncher
12 chris hough // Aug 16, 2009 at 10:25 PM
Leave a Comment