#!/bin/sh ##----------------------------------------------------------------------------- ## cserver.new - fli4l mtgcapri startscript for mtG Capriserver __FLI4LVER__ ## ## You can edit/change this file with any text editor. ## ## P L E A S E R E A D T H E D O C U M E N T A T I O N , ## ## B I T T E U N B E D I N G T D I E D O K U M E N T A T I O N L E S E N ## ## Creation: 2006-04-19 ## Last Update: $Id$ ## ## (c) 2006 Helmut Hummel ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ##----------------------------------------------------------------------------- CAPRIROOT=/usr/local/mtG-CAPRI-Server status () { if ps | grep "./[c]apriserver" | grep -qv service then return 0 else if ps | grep -q "./[c]apriserver" then # killing stale restart scripts kill `ps | grep "./[c]apriserver" | cut -c -5` fi return 1 fi } case "$1" in '-d') debug="yes"; shift ;; esac case "$1" in 'start') if ! status then cd ${CAPRIROOT}/bin if [ -f capriserver ] then LD_LIBRARY_PATH=${CAPRIROOT}/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH case $debug in yes) colecho "Starting mtG-CAPRI-Server in debug mode, press +C to stop!" br n br ./capriserver ;; *) colecho "Starting mtG-CAPRI-Server ..." w b br service-restart.sh 2 ./capriserver 1>${CAPRIROOT}/trace/capri.out 2>&1 & sleep 2 if status then colecho " ... done." gn else colecho " ... failed!" rd #[ -f /usr/local/mtG-CAPRI-Server/trace/capri.out ] && colecho " `cat /usr/local/mtG-CAPRI-Server/trace/capri.out`" rd exit 1 fi ;; esac fi else $0 status fi ;; 'stop') if status then colecho "Stopping mtG-CAPRI-Server ..." w n br capriserverpid=`ps | grep "./[c]apriserver" | cut -c -5` kill $capriserverpid sleep 2 if ! status then colecho " ... done." gn else colecho " ... failed!" rd exit 1 fi else $0 status fi ;; 'status') if status then colecho "mtG-CAPRI-Server is running!" b gn else colecho "mtG-CAPRI-Server is not running!" b rd fi ;; 'restart'|'reload') $0 stop && sleep 3 && $0 start ;; *) echo "Usage: `basename $0` [-d] { status | start | stop | restart | reload }" exit 1 ;; esac