meta-digi/meta-digi-dey/recipes-connectivity/vsftpd/files/init

53 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
#===============================================================================
#
# vsftpd
#
# Copyright (C) 2013 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# !Description: vsftpd bootscript
#
#===============================================================================
set -e
daemon="/usr/sbin/vsftpd"
pidfile="/var/run/vsftpd.pid"
[ -x "${daemon}" ] || exit 0
# Required directories
[ -d /var/run ] || install -m 755 -o root -g root -d /var/run
[ -d /var/lib/ftp ] || install -m 755 -o root -g ftp -d /var/lib/ftp
[ -d /var/share/empty ] || install -m 755 -o root -g root -d /var/share/empty
case "${1}" in
start)
echo -n "Starting vsftpd server: "
if [ -s "${pidfile}" ]; then
pid="$(cat ${pidfile})"
if kill -0 "${pid}" 2>/dev/null; then
echo " already running."
exit 0
fi
fi
start-stop-daemon -S -b -m -p "${pidfile}" -x "${daemon}"
echo "done"
;;
stop)
echo -n "Stopping vsftpd server: "
start-stop-daemon -K -q -p "${pidfile}"
rm "${pidfile}"
echo "done"
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac