diff -r b3f4be54aeb4 -r 5be956b2db74 chiliproj/rc.chiliproj --- a/chiliproj/rc.chiliproj Sun Mar 31 17:55:10 2013 +0200 +++ b/chiliproj/rc.chiliproj Mon Apr 01 19:50:38 2013 +0200 @@ -6,44 +6,88 @@ %config chili_enable="$openpkg_rc_def" chili_host="localhost" + chili_port=3000 + chili_svcs=1 chili_log_prolog="true" chili_log_epilog="true" chili_log_numfiles="10" chili_log_minsize="1M" chili_log_complevel="9" + chili_logfile="@l_prefix@/lib/chiliproj/log/production.log" + chili_thinpath="@l_prefix@/var/chiliproj" + +%common + chili_pidpath="@l_prefix@/var/chiliproj" + chili_signal () { + for thepid in ${chili_pidpath}/thind.[0-9][0-9]*.pid; do + [ -f $thepid ] && kill -$1 `cat $thepid` + proclive=$? + if [ $proclive = 0 ]; then break; fi + done + [ $proclive = 0 ] + } %status -u @l_susr@ -o chili_usable="unknown" - #chili_active="no" - chili_active="unknown" - # rcService chiliproj enable yes && \ - # check pid or something >/dev/null 2>&1 && \ - # chili_active="yes" + chili_active="no" + rcService chiliproj enable yes && \ + chili_signal 0 && chili_active="yes" echo "chili_enable=\"$chili_enable\"" echo "chili_usable=\"$chili_usable\"" echo "chili_active=\"$chili_active\"" -%start -u @l_nusr@ +%start -u @l_susr@ rcService chiliproj enable yes || exit 0 rcService chiliproj active yes && exit 0 - PATH=$PATH:@l_gempath@/bin bundle exec thin -e production -a $chili_host start +#--ssl +#--ssl-verify +#--ssl-key-file +#--ssl-cert-file + cd @l_chilipath@ && \ + @l_gempath@/bin/bundle exec thin \ + -d \ + -e production \ + -u @l_nusr@ \ + -g @l_mgrp@ \ + -a $chili_host \ + -p $chili_port \ + -s $chili_svcs \ + -P $chili_pidpath/thind.pid \ + -l $chili_thinpath/thind.log \ + start -%stop -u @l_nusr@ +%stop -u @l_susr@ rcService chiliproj enable yes || exit 0 rcService chiliproj active no && exit 0 - # send kill -TERM to pid + cd @l_chilipath@ && \ + @l_gempath@/bin/bundle exec thin \ + -P ${chili_pidpath}/thind.pid stop -%restart -u @l_nusr@ +%restart -u @l_susr@ rcService chiliproj enable yes || exit 0 rcService chiliproj active no && exit 0 - # do stop sleep start + rc chiliproj stop + sleep 2 + rc chiliproj start -%daily -u @l_nusr@ +%daily -u @l_susr@ rcService chiliproj enable yes || exit 0 -# shtool rotate -f \ -# -n ${chili_log_numfiles} -s ${chili_log_minsize} -d \ -# -z ${chili_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ -# -P "${chili_log_prolog}" \ -# -E "${chili_log_epilog}; rc chiliproj logrel" \ -# @l_prefix@/lib/chiliproj/log/chiliproject.log + rcTmp -i + hintfile=`rcTmp -f -n hint` + shtool rotate -f \ + -n ${chili_log_numfiles} -s ${chili_log_minsize} -d \ + -z ${chili_log_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \ + -P "${chili_log_prolog}" \ + -E "${chili_log_epilog}; echo 1 >$hintfile" \ + ${chili_logfile} + shtool rotate -f \ + -n ${chili_thin_numfiles} -s ${chili_thin_minsize} -d \ + -z ${chili_thin_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \ + -P "${chili_thin_prolog}" \ + -E "${chili_thin_epilog}; echo 1 >$hintfile" \ + ${chili_thinpath}/thind.*.log + if [ -s $hintfile ]; then + rc chiliproj restart + fi + rcTmp -k