1#!/bin/sh 2# 3 4# 5# PROVIDE: yaws 6# REQUIRE: DAEMON 7# 8# You will need to set some variables in /etc/rc.conf to start Yaws: 9# 10# yaws=YES 11# yaws_flags="" 12# yaws_id="" 13# 14 15if [ -f /etc/rc.subr ]; then 16 . /etc/rc.subr 17fi 18 19name="yaws" 20rcvar=$name 21yaws_command="%bindir%/${name}" 22required_files="%etcdir%/yaws/yaws.conf" 23 24start_cmd="yaws_start" 25stop_cmd="yaws_stop" 26status_cmd="yaws_status" 27reload_cmd="yaws_reload" 28extra_commands="reload status" 29 30if [ -n "$yaws_id" ] 31then 32 yaws_id="--id $yaws_id" 33fi 34: ${yaws_flags:=--heart} 35 36yaws_start() { 37 echo -n "Starting Yaws: " 38 $yaws_command $yaws_id $yaws_flags --daemon --conf %etcdir%/yaws/yaws.conf >/dev/null 39 $yaws_command $yaws_id --wait-started=10 >/dev/null 40 RETVAL=$? 41 if [ $RETVAL = 0 ]; then 42 echo "OK" 43 else 44 echo "FAILED" 45 fi 46 return $RETVAL 47} 48 49yaws_stop() { 50 echo -n "Stopping Yaws: " 51 $yaws_command $yaws_id --stop >/dev/null 52 $yaws_command $yaws_id --wait-stopped=10 >/dev/null 53 RETVAL=$? 54 if [ $RETVAL = 0 ]; then 55 echo "OK" 56 else 57 echo "FAILED" 58 fi 59 return $RETVAL 60} 61 62yaws_status() { 63 $yaws_command $yaws_id --status >/dev/null 64 RETVAL=$? 65 if [ $RETVAL = 0 ]; then 66 echo "Yaws is running" 67 else 68 echo "Yaws is stopped" 69 fi 70 return $RETVAL 71} 72 73yaws_reload() { 74 echo -n "Reloading Yaws: " 75 $yaws_command $yaws_id --hup >/dev/null 76 RETVAL=$? 77 if [ $RETVAL = 0 ]; then 78 echo "OK" 79 else 80 echo "FAILED" 81 fi 82 return $RETVAL 83} 84 85if [ -f /etc/rc.subr -a -f /etc/rc.conf ]; then 86 load_rc_config $name 87 run_rc_command "$1" 88else 89 yaws_start 90fi 91