#!/bin/bash # trytond This shell script takes care of starting and stopping # server for the Tryton application framework # # chkconfig: - 95 05 # description: Tryton Server # # pidfile: /var/run/trytond.pid # config: /etc/trytond.conf ### BEGIN INIT INFO # Provides: trytond # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: # Default-Stop: 0 1 2 3 4 5 6 # Short-Description: start and stop trytond # Description: Tryton Server ### END INIT INFO PATH=/usr/bin:/sbin:/bin:/usr/sbin export PATH # Source function library. . /etc/rc.d/init.d/functions prog="trytond" PIDFILE=/var/lib/${prog}/${prog}.pid LOCKFILE=/var/lock/subsys/${prog} LOGFILE=/var/log/${prog}/${prog}.log OPTS= [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog OPTS="--pidfile=$PIDFILE --logfile=$LOGFILE $OPTS" # check if the trytond conf file is present, then use it if [ -f /etc/trytond.conf ]; then OPTS="--config /etc/trytond.conf $OPTS" fi RETVAL=0 start() { [ -z "/usr/bin/trytond" ] && exit 5 echo -n $"Starting $prog: " daemon --user tryton --check $prog --pidfile $PIDFILE "/usr/bin/setsid /usr/bin/trytond $OPTS 2>/dev/null &" RETVAL=$? [ $RETVAL -eq 0 ] && touch $LOCKFILE echo return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc -p $PIDFILE $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $LOCKFILE return $RETVAL } restart() { stop start } reload() { restart } force_reload() { restart } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" exit 1 esac exit $?