#!/bin/sh USER= ROOTDIR= CONFIG= HOSTNAME=`hostname -s` PIDDIR=$ROOTDIR/pids PID_TIG=$PIDDIR/tig.rb.pid PID_WIG=$PIDDIR/wig.rb.pid PID_HIG=$PIDDIR/hig.rb.pid PID_TIARRA=$PIDDIR/tiarra.pid if [ ! -d $PIDDIR ]; then mkdir -p $PIDDIR fi . /etc/rc.subr name=tiarra rcvar=`set_rcvar` load_rc_config $name : ${tiarra_enable="NO"} : ${tiarra_with_tig_enable="YES"} : ${tiarra_with_wig_enable="YES"} : ${tiarra_with_hig_enable="YES"} start_cmd=tiarra_start stop_cmd=tiarra_stop status_cmd=tiarra_status extra_commands="status" tiarra_start() { # net-irc cd $ROOTDIR/net-irc if checkyesno tiarra_with_tig_enable; then daemon -u $USER -p $PID_TIG ./examples/tig.rb --host $HOSTNAME fi if checkyesno tiarra_with_wig_enable; then daemon -u $USER -p $PID_WIG ./examples/wig.rb --host $HOSTNAME fi if checkyesno tiarra_with_hig_enable; then daemon -u $USER -p $PID_HIG ./examples/hig.rb --host $HOSTNAME fi # tiarra cd $ROOTDIR/tiarra daemon -u $USER -p $PID_TIARRA ./tiarra --config=$CONFIG --no-fork --quiet } tiarra_stop() { # net-irc if [ -f $PID_TIG ]; then kill `cat $PID_TIG` rm -f $PID_TIG fi if [ -f $PID_WIG ]; then kill `cat $PID_WIG` rm -f $PID_WIG fi if [ -f $PID_HIG ]; then kill `cat $PID_HIG` rm -f $PID_HIG fi # tiarra if [ -f $PID_TIARRA ]; then kill `cat $PID_TIARRA` rm -f $PID_TIARRA fi } tiarra_status() { # net-irc if [ -f $PID_TIG ]; then echo "tig.rb is running as pid `cat $PID_TIG`." else echo "tig.rb is not running." fi if [ -f $PID_WIG ]; then echo "wig.rb is running as pid `cat $PID_WIG`." else echo "hig.rb is not running." fi if [ -f $PID_HIG ]; then echo "hig.rb is running as pid `cat $PID_HIG`." else echo "hig.rb is not running." fi # tiarra if [ -f $PID_TIARRA ]; then echo "tiarra is running as pid `cat $PID_TIARRA`." else echo "tiarra is not running." fi } run_rc_command "$1"