#!/bin/bash # # chkconfig: 2345 85 15 # description: Starts and stops the Clinical Data Source MESA test actor. # ClinicalDataSource Service script for Linux # account running the cds USER=mesa # location where CDS is installed HOME="/opt/cds" # path to CDS's log file LOGFILE="${HOME}/log/cds.log" start() { echo $"Starting ClinicalDataSource: " su - $USER -c "${HOME}/runCDS" if [ $? -eq 0 ]; then echo "ClinicalDataSource started successfully" exit 0 else echo "ClinicalDataSource did not start. See ${LOGFILE}" exit 1 fi } stop() { local pid=`ps -aef | grep ClinicalDataSource | grep -v grep | awk '{print $2}'` if [ -n "$pid" ]; then echo $"Stopping ClinicalDataSource, procees id:" $pid # need -9 to kill the jvm, apparently. kill -9 $pid else echo $"ClinicalDataSource is not running." fi } status() { local pid=`ps -aef | grep ClinicalDataSource | grep -v grep | awk '{print $2}'` if [ -n "$pid" ]; then echo $"ClinicalDataSource is running, procees id:" $pid else echo $"ClinicalDataSource is not running." fi } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop sleep 3 start ;; status) status ;; *) echo $"Usage: clinicalDataSource {start|stop|restart|status}" exit 1 esac