Mercurial > dive4elements > river
view contrib/init.d/d4e-river @ 8542:7b210881d6db
(issue1753) Remove "measured" from CSV header
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 13 Feb 2015 13:44:52 +0100 |
parents | 0000ed802cad |
children |
line wrap: on
line source
#!/bin/bash # ### BEGIN INIT INFO # Provides: d4e-server # Required-Start: $network $syslog $remote_fs # Should-Start: $named $syslog $time # Required-Stop: $network $syslog # Should-Stop: $named $syslog $time # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Dive4Elements server # Description: Start Dive4Elements server ### END INIT INFO RUNAS=flys START_SCRIPT="/opt/flys/d4e-start" NAME="$(basename $0)" SHUTDOWN_WAIT="30" export FLYSDIR="/opt/flys/current/server" unset ISBOOT if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then NAME="${NAME:3}" ISBOOT="1" fi # remove SUSE's rc name if [ "${NAME:0:2}" = "rc" ]; then NAME="${NAME:2}" fi export LOGFILE=/var/log/d4e-river.log export ARGS="-Xmx256m \ -server \ -Djava.awt.headless=true \ -Dflys.datacage.recommendations.development=false \ -Djava.io.tmpdir=$FLYSDIR/cache \ -Dflys.backend.enablejmx=true \ -Dflys.uesk.keep.artifactsdir=false \ -Dwsplgen.bin.path=$FLYSDIR/bin/wsplgen \ -Dwsplgen.log.output=false \ -Dlog4j.configuration=file://$FLYSDIR/conf/log4j.properties \ -Dartifact.database.dir=$FLYSDIR/conf" export MAINCLASS=org.dive4elements.artifactdatabase.App # For SELinux we need to use 'runuser' not 'su' if [ -x "/sbin/runuser" ]; then SU="/sbin/runuser" else SU="/bin/su -m" fi # pulled from RHEL4 /etc/rc.d/init.d/functions function checkpid() { local i for i in $* ; do if [ -d "/proc/${i}" ]; then return 0 fi done return 1 } . /etc/rc.status rc_reset function start() { echo -n "Starting D4E-river server... " if [ -f "/var/lock/subsys/${NAME}" ] ; then if [ -f "/var/run/${NAME}.pid" ]; then read kpid < /var/run/${NAME}.pid if checkpid $kpid 2>&1; then echo "$NAME process already running with pid $kpid" rc_failed 0 exit else echo "lock file found but no process running for pid $kpid, continuing" rc_failed 7 fi fi fi export D4E_PID="/var/run/${NAME}.pid" touch $D4E_PID chown $RUNAS $D4E_PID touch $LOGFILE chown $RUNAS $LOGFILE for l in `find "$FLYSDIR/bin/lib" -name \*.jar -print`; do CLASSPATH=$CLASSPATH:$l done export CLASSPATH $SU $RUNAS -c "$START_SCRIPT" #>> $LOGFILE 2>&1 RETVAL="$?" if [ "$RETVAL" -eq 0 ]; then rc_failed 0 touch /var/lock/subsys/${NAME} else rc_failed 7 fi rc_status -v } function stop() { echo -n "Shutting down D4E-River" if [ -f "/var/lock/subsys/${NAME}" ]; then count="0" if [ -f "/var/run/${NAME}.pid" ]; then read kpid < /var/run/${NAME}.pid kill $kpid until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \ [ "$count" -gt "$SHUTDOWN_WAIT" ]; do if [ "$SHUTDOWN_VERBOSE" = "true" ]; then echo -n -e "\nwaiting for processes $kpid to exit" fi sleep 1 let count="${count}+1" done if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then if [ "$SHUTDOWN_VERBOSE" = "true" ]; then echo -n -e "\nkilling processes which didn't stop" echo -n -e "after " echo -n "$SHUTDOWN_WAIT seconds" fi kill -9 $kpid fi rc_failed 0 if [ "$count" -gt "0" ]; then echo -n -e "\n" fi fi rm -f /var/lock/subsys/${NAME} /var/run/${NAME}.pid fi rc_status -v } case "$1" in start) start ;; stop) stop ;; restart) $0 stop && $0 start ;; *) echo "Usage: $0 [start|stop|restart]" esac