Mon, 01 Jul 2013 20:56:52 +0200
Correct configuration keyword, removing superfluous double quote.
1 #! @l_prefix@/bin/openpkg rc
2 ##
3 ## rc.chiliproj -- Run-Commands
4 ##
6 %config
7 chiliproj_enable="$openpkg_rc_def"
8 chiliproj_cleartext="yes"
9 chiliproj_tlsecured="no"
10 #chiliproj_flags="-u @l_nusr@ -g @l_musr@"
11 chiliproj_flags=""
12 chiliproj_host="localhost"
13 chiliproj_port_clt=80
14 chiliproj_port_tls=443
15 chiliproj_svcs=1
16 chiliproj_key="@l_prefix@/etc/openssl/host-ca-rsa-4096-key.pem"
17 chiliproj_crt="@l_prefix@/etc/openssl/host-ca-rsa-4096-crt.pem"
18 chiliproj_log_prolog="true"
19 chiliproj_log_epilog="true"
20 chiliproj_log_numfiles="10"
21 chiliproj_log_minsize="1M"
22 chiliproj_log_complevel="9"
23 chiliproj_logfile="@l_prefix@/lib/chiliproj/log/production.log"
24 chiliproj_thinpath="@l_prefix@/var/chiliproj"
26 %common
27 chiliproj_pidpath="@l_prefix@/var/chiliproj"
28 chiliproj_signal () {
29 for thepid in ${chiliproj_pidpath}/thind.[0-9][0-9]*.pid; do
30 [ -f $thepid ] && kill -$1 `cat $thepid`
31 proclive=$?
32 if [ $proclive = 0 ]; then break; fi
33 done
34 [ $proclive = 0 ]
35 }
37 %status -u @l_susr@ -o
38 chiliproj_usable="unknown"
39 chiliproj_active="no"
40 rcService chiliproj enable yes && \
41 chiliproj_signal 0 && chiliproj_active="yes"
42 echo "chiliproj_enable=\"$chiliproj_enable\""
43 echo "chiliproj_usable=\"$chiliproj_usable\""
44 echo "chiliproj_active=\"$chiliproj_active\""
46 %start -u @l_susr@
47 rcService chiliproj enable yes || exit 0
48 rcService chiliproj active yes && exit 0
49 if [ "$chiliproj_cleartext" = "yes" ]; then
50 cd @l_chilipath@ && \
51 @l_gempath@/bin/bundle exec thin \
52 -d \
53 -e production \
54 -a $chiliproj_host \
55 -p $chiliproj_port_clt \
56 -s $chiliproj_svcs \
57 -P $chiliproj_pidpath/thind.pid \
58 -l $chiliproj_thinpath/thind.log \
59 $chiliproj_flags \
60 start
61 fi
62 if [ "$chiliproj_tlsecured" = "yes" ]; then
63 cd @l_prefix@/lib/chiliproj && \
64 @l_gempath@/bin/bundle exec thin \
65 -d \
66 -e production \
67 -a $chiliproj_host \
68 -p $chiliproj_port_tls \
69 -s $chiliproj_svcs \
70 -P $chiliproj_pidpath/thind.pid \
71 -l $chiliproj_thinpath/thind.log \
72 --ssl \
73 --ssl-key-file $chiliproj_key \
74 --ssl-cert-file $chiliproj_crt \
75 $chiliproj_flags \
76 start
77 fi
79 %stop -u @l_susr@
80 rcService chiliproj enable yes || exit 0
81 rcService chiliproj active no && exit 0
82 cd @l_chilipath@
83 for thepid in ${chiliproj_pidpath}/thind.[0-9][0-9]*.pid; do
84 cd @l_prefix@/lib/chiliproj
85 @l_gempath@/bin/bundle exec thin -P $thepid stop
86 done
88 %restart -u @l_susr@
89 rcService chiliproj enable yes || exit 0
90 rcService chiliproj active no && exit 0
91 rc chiliproj stop
92 sleep 2
93 rc chiliproj start
95 %daily -u @l_susr@
96 rcService chiliproj enable yes || exit 0
97 rcTmp -i
98 hintfile=`rcTmp -f -n hint`
99 shtool rotate -f \
100 -n ${chiliproj_log_numfiles} -s ${chiliproj_log_minsize} -d \
101 -z ${chiliproj_log_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \
102 -P "${chiliproj_log_prolog}" \
103 -E "${chiliproj_log_epilog}; echo 1 >$hintfile" \
104 ${chiliproj_logfile}
105 shtool rotate -f \
106 -n ${chiliproj_thin_numfiles} -s ${chiliproj_thin_minsize} -d \
107 -z ${chiliproj_thin_complevel} -m 664 -o @l_nusr@ -g @l_mgrp@ \
108 -P "${chiliproj_thin_prolog}" \
109 -E "${chiliproj_thin_epilog}; echo 1 >$hintfile" \
110 ${chiliproj_thinpath}/thind.*.log
111 if [ -s $hintfile ]; then
112 rc chiliproj restart
113 fi
114 rcTmp -k