Mon, 25 Aug 2014 19:07:19 +0200
Correct process identification writing of PID file on -P parameter.
michael@795 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@795 | 2 | ## |
michael@795 | 3 | ## rc.tftp -- Run-Commands |
michael@795 | 4 | ## |
michael@795 | 5 | |
michael@795 | 6 | %config |
michael@795 | 7 | tftp_enable="$openpkg_rc_def" |
michael@795 | 8 | tftp_listen="127.0.0.1:69" |
michael@795 | 9 | tftp_flags="" |
michael@795 | 10 | tftp_rootdir="@l_prefix@/pub" |
michael@795 | 11 | tftp_log_prolog="true" |
michael@795 | 12 | tftp_log_epilog="true" |
michael@795 | 13 | tftp_log_numfiles="10" |
michael@795 | 14 | tftp_log_minsize="1M" |
michael@795 | 15 | tftp_log_complevel="9" |
michael@795 | 16 | |
michael@795 | 17 | %common |
michael@795 | 18 | tftp_pidfile="@l_prefix@/var/tftp/tftpd.pid" |
michael@795 | 19 | tftp_signal () { |
michael@795 | 20 | [ -f $tftp_pidfile ] && kill -$1 `cat $tftp_pidfile` |
michael@795 | 21 | } |
michael@795 | 22 | |
michael@795 | 23 | %status -u @l_susr@ -o |
michael@795 | 24 | tftp_usable="unknown" |
michael@795 | 25 | tftp_active="no" |
michael@795 | 26 | rcService tftp enable yes && \ |
michael@795 | 27 | tftp_signal 0 && tftp_active="yes" |
michael@795 | 28 | echo "tftp_enable=\"$tftp_enable\"" |
michael@795 | 29 | echo "tftp_usable=\"$tftp_usable\"" |
michael@795 | 30 | echo "tftp_active=\"$tftp_active\"" |
michael@795 | 31 | |
michael@795 | 32 | %start -u @l_susr@ |
michael@795 | 33 | rcService tftp enable yes || exit 0 |
michael@795 | 34 | rcService tftp active yes && exit 0 |
michael@796 | 35 | opts="-l -u @l_nusr@ -m @l_prefix@/etc/tftp/tftpd.remap -P$tftp_pidfile" |
michael@795 | 36 | if [ ".$tftp_listen" != . ]; then |
michael@795 | 37 | opts="$opts -a $tftp_listen" |
michael@795 | 38 | fi |
michael@795 | 39 | if [ ".$tftp_flags" != . ]; then |
michael@795 | 40 | opts="$opts $tftp_flags" |
michael@795 | 41 | fi |
michael@795 | 42 | @l_prefix@/sbin/tftpd $opts -s $tftp_rootdir |
michael@795 | 43 | |
michael@795 | 44 | %stop -u @l_susr@ |
michael@795 | 45 | rcService tftp enable yes || exit 0 |
michael@795 | 46 | rcService tftp active no && exit 0 |
michael@795 | 47 | tftp_signal TERM |
michael@795 | 48 | rm -f $tftp_pidfile 2>/dev/null || true |
michael@795 | 49 | |
michael@795 | 50 | %restart -u @l_susr@ |
michael@795 | 51 | rcService tftp enable yes || exit 0 |
michael@795 | 52 | rcService tftp active no && exit 0 |
michael@795 | 53 | rc tftp stop |
michael@795 | 54 | sleep 2 |
michael@795 | 55 | rc tftp start |
michael@795 | 56 | |
michael@795 | 57 | %daily -u @l_susr@ |
michael@795 | 58 | rcService tftp enable yes || exit 0 |
michael@795 | 59 | shtool rotate -f \ |
michael@795 | 60 | -n ${tftp_log_numfiles} -s ${tftp_log_minsize} -d \ |
michael@795 | 61 | -z ${tftp_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ |
michael@795 | 62 | -P "${tftp_log_prolog}" \ |
michael@795 | 63 | -E "${tftp_log_epilog}; rc tftp restart" \ |
michael@795 | 64 | @l_prefix@/var/tftp/tftp.log |
michael@795 | 65 |