[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Running terracotta server as a linux service  XML
Forum Index -> General
Author Message
richardw

journeyman

Joined: 05/16/2008 03:38:29
Messages: 33
Offline

Has anyone got a terracotta server running as a linux service? I see that there are start and stop scripts, but when i run the start server script the server starts and logs to the console, can I specify for it to run as a service so that to stop it you need to run the stop server script?

Thanks,

Richard
rreja

journeyman

Joined: 05/16/2008 13:04:24
Messages: 30
Offline

You can always run the server in background as
$ $TC_INSTALL_DIR/bin/start-tc-server.sh &

And then for stopping it run the stop script

$ $TC_INSTALL_DIR/bin/stop-tc-server

I hope this answers your question.

Thanks,
Rohit Reja
[Yahoo!] aim icon
teck

seraphim
[Avatar]
Joined: 05/24/2006 15:03:25
Messages: 1128
Offline

I'd add that using nohup in addition to backgrounding the process is a good idea.

I could imagine that terracotta could ship /etc/init.d style scripts for the server process, but to the best of my knowledge I've never seen any before. It also isn't clear to me if such things are really standardized accross linux distributions (not to mention making ones for solaris, mac, windows, etc)

Tim Eck (terracotta engineer)
dmangot

journeyman

Joined: 05/24/2006 13:00:33
Messages: 28
Location: San Francisco, USA
Offline

Something like this?

Code:
 $ cat terracotta 
 #!/bin/sh
 #
 #
 # chkconfig: 2345 55 25
 # description: Terracotta L2 server daemon                                                                                                                 
 #
 # shamelessy taken from the jsvc example script for Tomcat 
 # 
 JAVA_HOME=/usr/java/jdk1.5.0_09
 JAVA_OPTS="-server -Xms256m -Xmx256m -Dcom.sun.management.jmxremote"
 TC_HOME=/usr/local/terracotta
 DATA_DIR=/export1/tc-data
 CONFIG_FILE=tc-config.xml
 TC_OPTS="-Dtc.config=${DATA_DIR}/configs/${CONFIG_FILE}"
 LOG_DIR=logs-primary
 #LOG_DIR=logs-secondary
 CLASSPATH=\
 ${TC_HOME}/common/lib/tc.jar
 TC_USER=_tc
 TC_SERVER=l2a
 
 
 case "$1" in
   start)
     #
     # Start Terracotta
     #
     su - $TC_USER -c "${JAVA_HOME}/bin/java \
     $TC_OPTS \
     $JAVA_OPTS \
     -Dtc.server.name=$TC_SERVER \
     -Dtc.install-root=$TC_HOME \
     -classpath $CLASSPATH \
     com.tc.server.TCServerMain  > ${DATA_DIR}/${LOG_DIR}/terracotta.out  2>&1 &"
     ;;
 
   stop)
     #
     # Stop Terracotta
     #
     su - $TC_USER -c "${JAVA_HOME}/bin/java \
     $TC_OPTS \
     $JAVA_OPTS \
     -Dtc.install-root=$TC_HOME \
     -classpath $CLASSPATH \
     com.tc.admin.TCStop -n $TC_SERVER"
     ;;
 
   *)
     echo "Usage terracotta start/stop"
     exit 1;;
 esac
 


That worked fine in Teracotta 2.2.1 which was a long time ago. If it doesn't work let me know. I'm going to be using it for 2.6 so I'm going to have to update it if necessary anyway.

Also working towards a full LSB compliant script soon too.

Hope that helps.

-Dave

[WWW] [Yahoo!]
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.7 © JForum Team