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