Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
1 #!@l_prefix@/bin/openpkg rc
2 ##
3 ## rc.gmediaserver -- runcommands
4 ##
6 %config
7 gmediaserver_enable="$openpkg_rc_def"
8 gmediaserver_log_prolog="true"
9 gmediaserver_log_epilog="true"
10 gmediaserver_log_numfiles="10"
11 gmediaserver_log_minsize="1M"
12 gmediaserver_log_complevel="9"
13 gmediaserver_name="GMediaServer"
14 gmediaserver_fschar="ISO-8859-1"
15 gmediaserver_devchar="ISO-8859-1"
16 gmediaserver_logchar="ISO-8859-1"
17 gmediaserver_profile="generic"
18 gmediaserver_ftypes="ogg,mp3,wma,wav,pls,m3u,m4a,jpg,png,unknown"
19 gmediaserver_expire="100"
20 gmediaserver_iface="lo0"
21 gmediaserver_port="49152"
22 gmediaserver_dirs="@l_prefix@/share/gmediaserver"
23 gmediaserver_cmdstart="echo 'route add -net 239.0.0.0 netmask 255.0.0.0 dev lo0'"
24 gmediaserver_cmdstop="echo 'route del -net 239.0.0.0 netmask 255.0.0.0 dev lo0'"
26 %common
27 gmediaserver_pidfile="@l_prefix@/var/gmediaserver/run/gmediaserver.pid"
28 gmediaserver_logfile="@l_prefix@/var/gmediaserver/log/gmediaserver.log"
29 gmediaserver_signal () {
30 [ -f $gmediaserver_pidfile ] && kill -$1 `cat $gmediaserver_pidfile`
31 }
33 %status -u @l_susr@ -o
34 gmediaserver_usable="no"
35 gmediaserver_active="no"
36 rcService gmediaserver enable yes && \
37 gmediaserver_usable="yes"
38 rcService gmediaserver enable yes && \
39 gmediaserver_signal 0 && gmediaserver_active="yes"
40 echo "gmediaserver_enable=\"$gmediaserver_enable\""
41 echo "gmediaserver_usable=\"$gmediaserver_usable\""
42 echo "gmediaserver_active=\"$gmediaserver_active\""
44 %start -u @l_susr@
45 rcService gmediaserver enable yes || exit 0
46 rcService gmediaserver active yes && exit 0
47 eval $gmediaserver_cmdstart
48 @l_prefix@/bin/gmediaserver \
49 --friendly-name=$gmediaserver_name \
50 --fs-charset=$gmediaserver_fschar \
51 --device-charset=$gmediaserver_devchar \
52 --log-charset=$gmediaserver_logchar \
53 --profile=$gmediaserver_profile \
54 --file-types=$gmediaserver_ftypes \
55 --expire-time=$gmediaserver_expire \
56 --interface=$gmediaserver_iface \
57 --port=$gmediaserver_port \
58 --pid-file=$gmediaserver_pidfile \
59 --output=$gmediaserver_logfile \
60 --background \
61 --timestamp \
62 $gmediaserver_dirs
64 %stop -u @l_susr@
65 rcService gmediaserver enable yes || exit 0
66 rcService gmediaserver active no && exit 0
67 gmediaserver_signal TERM
68 eval $gmediaserver_cmdstop
70 %restart -u @l_susr@
71 rcService gmediaserver enable yes || exit 0
72 rcService gmediaserver active no && exit 0
73 rc gmediaserver stop
74 sleep 2
75 rc gmediaserver start
77 %reload -u @l_susr@
78 rcService gmediaserver enable yes || exit 0
79 rcService gmediaserver active no && exit 0
80 gmediaserver_signal USR1
82 %daily -u @l_susr@
83 rcService gmediaserver enable yes || exit 0
84 shtool rotate -f \
85 -n ${gmediaserver_log_numfiles} -s ${gmediaserver_log_minsize} -d \
86 -z ${gmediaserver_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
87 -P "${gmediaserver_log_prolog}" \
88 -E "${gmediaserver_log_epilog}; rc gmediaserver restart" \
89 @l_prefix@/var/gmediaserver/log/gmediaserver.log \
90 @l_prefix@/var/gmediaserver/log/arpsnmp.log