Listing 1. oftpd init Script for Debian
#! /bin/sh
# oftpd init script for Debian
# location of the oftpd executable
OFTPD=/usr/local/sbin/oftpd
# user to run as
USER=oftpd
# FTP home directory
FTPROOT=/home/httpd/htdocs
test -x $OFTPD || exit 0
case "$1" in
start)
echo -n "Starting oftpd"
start-stop-daemon --start --quiet \
--exec $OFTPD $USER $FTPROOT
echo "."
;;
stop)
echo -n "Stopping oftpd"
# redirect to /dev/null here because we're
# brute-force killing all oftpds by name.
start-stop-daemon --stop --quiet --oknodo \
--exec $OFTPD oftpd $FTPROOT &> /dev/null
echo "."
;;
restart|force-reload)
$0 stop
sleep 5
$0 start
;;
*)
echo -n "Usage: /etc/init.d/oftpd"
echo "{start|stop|restart|force-reload}"
exit 1
esac
exit 0
Copyright © 1994 - 2019 Linux Journal. All rights reserved.