13 rcvar="ftpproxy_enable"
14 command="/usr/sbin/ftp-proxy"
20 # Create or remove a pidfile manually, for daemons that can't be bothered
21 # to do it themselves. Takes one argument, which is the argument provided
22 # to the rc script. The pidfile will be named /var/run/<$name>.pid,
23 # unless $pidfile is defined.
25 # The method used to determine the pid is rather hacky; grep ps output to
26 # find '$procname|$command', then grep for ${name}_flags. If at all
27 # possible, use another method if at all possible, to avoid that dirty-
31 local search_string ps_pid
34 cmd_string=`basename ${procname:-${command}}`
35 eval flag_string=\"\$${name}_flags\"
37 ps_pid=`ps ax -o pid= -o command= | grep $cmd_string | grep -e "$flag_string" | grep -v grep | awk '{ print $1 }'`
38 # Write the pidfile depending on $pidfile status.
39 echo $ps_pid > ${pidfile:-"/var/run/$name.pid"}
47 # Allow ftp-proxy to start up in two different ways. The typical behavior
48 # is to start up one instance of ftp-proxy by setting ftpproxy_enable and
49 # ftpproxy_flags. The alternate behavior allows multiple instances of ftp-
50 # proxy to be started, allowing different types of proxy behavior. To use the
51 # new behavior, a list of instances must be defined, and a list of flags for
52 # each instance. For example, if we want to start two instances of ftp-proxy,
53 # foo and bar, we would set the following vars.
54 # ftpproxy_enable="YES"
55 # ftpproxy_instances="foo bar"
56 # ftpproxy_foo="<arguments for foo>"
57 # ftpproxy_bar="<arguments for bar>"
59 # Starting more than one ftp-proxy?
60 if [ "$ftpproxy_instances" ] && [ -n "${ftpproxy_instances}" ]; then
61 # Iterate through instance list.
62 for i in $ftpproxy_instances; do
63 #eval ftpproxy_${i}_flags=\$ftpproxy_${i}
64 #eval name=ftpproxy_${i}
65 # Set flags for this instance.
66 eval ftpproxy_flags=\$ftpproxy_${i}
67 # Define a unique pid file name.
68 pidfile="/var/run/ftp-proxy.$i.pid"
73 # Traditional single-instance behavior