diff options
Diffstat (limited to 'japanese/ndtpd/files/ndtpd.sh.sample')
-rw-r--r-- | japanese/ndtpd/files/ndtpd.sh.sample | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/japanese/ndtpd/files/ndtpd.sh.sample b/japanese/ndtpd/files/ndtpd.sh.sample index 17a62fc0aab8..bbf4f41b7508 100644 --- a/japanese/ndtpd/files/ndtpd.sh.sample +++ b/japanese/ndtpd/files/ndtpd.sh.sample @@ -1,15 +1,49 @@ -#!/bin/sh - -# -# NDTPD: rc-file for FreeBSD. -# - -### NDTPD options: ### -ndtpd_program=@prefix@/sbin/ndtpd # path to ndtpd. -ndtpd_enable=YES # Run ndtpd (or NO). -ndtpd_flags= # Flags to ndtpd (if enabled). -### End of NDTPD options: ### - -if [ "x${ndtpd_enable}" = xYES -a -x ${ndtpd_program} ]; then - echo -n " ndtpd" - ${ndtpd_program} ${ndtpd_flags} +#!/bin/sh -e - +# startup script for ndtpd + +# Usage: ndtpd.sh [kill|restart|status|terminate|stop|start] + +command=$1 +standalone=YES # Run ndtpd as a standalone daemon. +#standalone=NO # Run ndtpd as a child of inetd. + +GetDirective() { + directive=$1 + + awk '/^[ ]*'${directive}'[ ]+/ {print $2; exit}' ${conf} +} + +MakeWorkingDirectory() { + user="`GetDirective user`" + group="`GetDirective group`" + work="`GetDirective work-path`" + + rm -rf ${work:=@rundir@/ndtpd} + eval install -d ${user:+-o ${user}} ${group:+-g ${group}} ${work} +} + +conf=@prefix@/etc/ndtpd.conf + +[ -f ${conf} ] || exit +ndtpcheck || exit + +if [ "${standalone}" = YES ]; then + ctrl=ndtpcontrol + start="echo -n ' ndtpd'; ndtpd" +else + ctrl="echo 'Error: inetd invokes ndtpd.' >&2; false" fi + +case "${command}" in +kill|restart|status|terminate) + eval ${ctrl} ${command};; + +stop) + eval ${ctrl} terminate;; + +start|*) + MakeWorkingDirectory + eval ${start};; +esac + +exit |