#! /bin/sh ### BEGIN INIT INFO # Provides: traqbio # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: TraqBio ### END INIT INFO ## TraqBio settings VERSION="1.3.6" INSTALL_DIR="/home/youruser/traqbio" CONFIG="traqbio.conf" OPTS="" ## Linux user and group for TraqBio process RUN_AS_USER="traqbio" RUN_AS_GROUP="traqbio" ## memory settings for the JVM MIN_MEMORY="256M" MAX_MEMORY="512M" PID_FILE="/var/run/traqbio.pid" ## do not change the following JAR="$INSTALL_DIR/traqbio-$VERSION.jar" JAVA=`(command -v java)` JAVA_TRAQBIO_OPTS="-Xms$MIN_MEMORY -Xmx$MAX_MEMORY -jar $JAR run -c $CONFIG $OPTS" PID_FILE="/var/run/traqbio.pid" # Using the lsb functions to perform the operations. . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting TraqBio" "traqbio" || true if start-stop-daemon --start --oknodo --quiet --chuid "$RUN_AS_USER:$RUN_AS_GROUP" --chdir $INSTALL_DIR --background --make-pidfile --pidfile $PID_FILE --exec $JAVA -- $JAVA_TRAQBIO_OPTS; then log_end_msg 0 || true else log_end_msg 1 || true fi ;; stop) log_daemon_msg "Stopping TraqBio" "traqbio" || true if start-stop-daemon --stop --oknodo --quiet --pidfile $PID_FILE; then log_end_msg 0 || true else log_end_msg 1 || true fi ;; restart) log_daemon_msg "Restarting TraqBio" "traqbio" || true start-stop-daemon --stop --oknodo --quiet --retry 30 --pidfile $PID_FILE if start-stop-daemon --start --oknodo --quiet --chuid "$RUN_AS_USER:$RUN_AS_GROUP" --chdir $INSTALL_DIR --background --make-pidfile --pidfile $PID_FILE --exec $JAVA -- $JAVA_TRAQBIO_OPTS; then log_end_msg 0 || true else log_end_msg 1 || true fi ;; *) log_action_msg "Usage: /etc/init.d/traqbio {start|stop|restart}" || true exit 1 esac exit 0