| 4 ## |
4 ## |
| 5 |
5 |
| 6 %config |
6 %config |
| 7 chili_enable="$openpkg_rc_def" |
7 chili_enable="$openpkg_rc_def" |
| 8 chili_host="localhost" |
8 chili_host="localhost" |
| |
9 chili_port=3000 |
| |
10 chili_svcs=1 |
| 9 chili_log_prolog="true" |
11 chili_log_prolog="true" |
| 10 chili_log_epilog="true" |
12 chili_log_epilog="true" |
| 11 chili_log_numfiles="10" |
13 chili_log_numfiles="10" |
| 12 chili_log_minsize="1M" |
14 chili_log_minsize="1M" |
| 13 chili_log_complevel="9" |
15 chili_log_complevel="9" |
| |
16 chili_logfile="@l_prefix@/lib/chiliproj/log/production.log" |
| |
17 chili_thinpath="@l_prefix@/var/chiliproj" |
| |
18 |
| |
19 %common |
| |
20 chili_pidpath="@l_prefix@/var/chiliproj" |
| |
21 chili_signal () { |
| |
22 for thepid in ${chili_pidpath}/thind.[0-9][0-9]*.pid; do |
| |
23 [ -f $thepid ] && kill -$1 `cat $thepid` |
| |
24 proclive=$? |
| |
25 if [ $proclive = 0 ]; then break; fi |
| |
26 done |
| |
27 [ $proclive = 0 ] |
| |
28 } |
| 14 |
29 |
| 15 %status -u @l_susr@ -o |
30 %status -u @l_susr@ -o |
| 16 chili_usable="unknown" |
31 chili_usable="unknown" |
| 17 #chili_active="no" |
32 chili_active="no" |
| 18 chili_active="unknown" |
33 rcService chiliproj enable yes && \ |
| 19 # rcService chiliproj enable yes && \ |
34 chili_signal 0 && chili_active="yes" |
| 20 # check pid or something >/dev/null 2>&1 && \ |
|
| 21 # chili_active="yes" |
|
| 22 echo "chili_enable=\"$chili_enable\"" |
35 echo "chili_enable=\"$chili_enable\"" |
| 23 echo "chili_usable=\"$chili_usable\"" |
36 echo "chili_usable=\"$chili_usable\"" |
| 24 echo "chili_active=\"$chili_active\"" |
37 echo "chili_active=\"$chili_active\"" |
| 25 |
38 |
| 26 %start -u @l_nusr@ |
39 %start -u @l_susr@ |
| 27 rcService chiliproj enable yes || exit 0 |
40 rcService chiliproj enable yes || exit 0 |
| 28 rcService chiliproj active yes && exit 0 |
41 rcService chiliproj active yes && exit 0 |
| 29 PATH=$PATH:@l_gempath@/bin bundle exec thin -e production -a $chili_host start |
42 #--ssl |
| |
43 #--ssl-verify |
| |
44 #--ssl-key-file <path> |
| |
45 #--ssl-cert-file <path> |
| |
46 cd @l_chilipath@ && \ |
| |
47 @l_gempath@/bin/bundle exec thin \ |
| |
48 -d \ |
| |
49 -e production \ |
| |
50 -u @l_nusr@ \ |
| |
51 -g @l_mgrp@ \ |
| |
52 -a $chili_host \ |
| |
53 -p $chili_port \ |
| |
54 -s $chili_svcs \ |
| |
55 -P $chili_pidpath/thind.pid \ |
| |
56 -l $chili_thinpath/thind.log \ |
| |
57 start |
| 30 |
58 |
| 31 %stop -u @l_nusr@ |
59 %stop -u @l_susr@ |
| 32 rcService chiliproj enable yes || exit 0 |
60 rcService chiliproj enable yes || exit 0 |
| 33 rcService chiliproj active no && exit 0 |
61 rcService chiliproj active no && exit 0 |
| 34 # send kill -TERM to pid |
62 cd @l_chilipath@ && \ |
| |
63 @l_gempath@/bin/bundle exec thin \ |
| |
64 -P ${chili_pidpath}/thind.pid stop |
| 35 |
65 |
| 36 %restart -u @l_nusr@ |
66 %restart -u @l_susr@ |
| 37 rcService chiliproj enable yes || exit 0 |
67 rcService chiliproj enable yes || exit 0 |
| 38 rcService chiliproj active no && exit 0 |
68 rcService chiliproj active no && exit 0 |
| 39 # do stop sleep start |
69 rc chiliproj stop |
| |
70 sleep 2 |
| |
71 rc chiliproj start |
| 40 |
72 |
| 41 %daily -u @l_nusr@ |
73 %daily -u @l_susr@ |
| 42 rcService chiliproj enable yes || exit 0 |
74 rcService chiliproj enable yes || exit 0 |
| 43 # shtool rotate -f \ |
75 rcTmp -i |
| 44 # -n ${chili_log_numfiles} -s ${chili_log_minsize} -d \ |
76 hintfile=`rcTmp -f -n hint` |
| 45 # -z ${chili_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ |
77 shtool rotate -f \ |
| 46 # -P "${chili_log_prolog}" \ |
78 -n ${chili_log_numfiles} -s ${chili_log_minsize} -d \ |
| 47 # -E "${chili_log_epilog}; rc chiliproj logrel" \ |
79 -z ${chili_log_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \ |
| 48 # @l_prefix@/lib/chiliproj/log/chiliproject.log |
80 -P "${chili_log_prolog}" \ |
| |
81 -E "${chili_log_epilog}; echo 1 >$hintfile" \ |
| |
82 ${chili_logfile} |
| |
83 shtool rotate -f \ |
| |
84 -n ${chili_thin_numfiles} -s ${chili_thin_minsize} -d \ |
| |
85 -z ${chili_thin_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \ |
| |
86 -P "${chili_thin_prolog}" \ |
| |
87 -E "${chili_thin_epilog}; echo 1 >$hintfile" \ |
| |
88 ${chili_thinpath}/thind.*.log |
| |
89 if [ -s $hintfile ]; then |
| |
90 rc chiliproj restart |
| |
91 fi |
| |
92 rcTmp -k |
| 49 |
93 |