如何恢复/etc/init.d/pure-ftpd-mysql?

如何恢复/etc/init.d/pure-ftpd-mysql?

错误地...这是我的新 /etc/init.d/pure-ftpd-mysql:

    /etc/init.d/pure-ftpd-mysql restart

如何安装或恢复文件?标准apt-get removeapt-get installapt-get install --reinstall pure-ftpd-common pure-ftpd-mysql不给我该文件。

答案1

如果您有二进制 .deb 文件,则可以使用午夜指挥官(MC)从 shell 中导航并从中检索文件。

为了您的方便,这是在以下位置找到的文件pure-ftpd-mysql_1.0.36-1.1_i386.deb

#! /bin/sh
### BEGIN INIT INFO
# Provides:          pure-ftpd-mysql
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      slapd mysql postgresql-8.3 postgresql-8.4
# Should-Stop:       slapd mysql postgresql-8.3 postgresql-8.4
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO
#
# pure-ftpd     starts and stops the pure-ftpd ftp daemon
#
# Copyright 2002-2011 by Stefan Hornburg (Racke) <[email protected]>

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=pure-ftpd
DESC="ftp server"
: ${SSDAEMONLOGOPTS:="--quiet"}
UPLOADDAEMON=/usr/sbin/pure-uploadscript
UDNAME=pure-uploadscript
UDDESC="ftp upload handler"
WRAPPER=/usr/sbin/pure-ftpd-wrapper

# load LSB init-functions to get status_of_proc helper
. /lib/lsb/init-functions

PIDFILE=/var/run/pure-ftpd/pure-ftpd.pid

# try to figure with suffix this script is called,
# $0 might be a symlink pointing to this script
if [ -h $0 ]; then
        ME=`/bin/readlink $0`
else
        ME=$0
fi

SUFFIX=`basename $ME | sed -ne 's/^pure-ftpd-\(.*\)/\1/p'`
if [ "$SUFFIX" ] ; then
        DAEMON=/usr/sbin/pure-ftpd-$SUFFIX
else
        DAEMON=/usr/sbin/pure-ftpd
fi

export STANDALONE_OR_INETD=inetd
export VIRTUALCHROOT=
test -r /etc/default/pure-ftpd-common && . /etc/default/pure-ftpd-common

if [ "$VIRTUALCHROOT" = "true" ]; then
        if [ "$SUFFIX" ]; then
                SUFFIX="$SUFFIX-virtualchroot"
        else
                SUFFIX="virtualchroot"
        fi
fi

test -x $DAEMON || exit 0
test -x $WRAPPER || exit 0

set -e

if [ ! -e `dirname $PIDFILE` ];then
       mkdir `dirname $PIDFILE`
fi

start_uploadscript() {
        if [ "$UPLOADSCRIPT" -a "$STANDALONE_OR_INETD" != inetd ] && \
                egrep -i '^[    ]*(yes|1|on)[   ]*' /etc/pure-ftpd/conf/CallUploadScript > /dev/null 2>&1
        then
                UOPTS=""
                test "$UPLOADUID" && UOPTS="$UOPTS -u $UPLOADUID"
                test "$UPLOADGID" && UOPTS="$UOPTS -g $UPLOADGID"
                echo -n "$1 $UDDESC: "
                start-stop-daemon --start $SSDAEMONLOGOPTS --oknodo \
                        --exec $UPLOADDAEMON -- -r "$UPLOADSCRIPT" -B $UOPTS
                echo "$UDNAME."

        fi
}

case "$1" in
  start)
        test "$STANDALONE_OR_INETD" = standalone || exit 0
        echo -n "Starting $DESC: "
        start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile "$PIDFILE" \
                --exec $WRAPPER -- $SUFFIX
        start_uploadscript Starting
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
                --pidfile "$PIDFILE"
        start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
        echo "$NAME."
        ;;
  restart|force-reload)
        test "$STANDALONE_OR_INETD" = standalone || exit 0
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
                --pidfile "$PIDFILE"
        start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
        sleep 1
        start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile "$PIDFILE" \
                --exec $WRAPPER -- $SUFFIX
        start_uploadscript Restarting
        ;;
  status)
        status_of_proc -p /var/run/pure-ftpd/pure-ftpd.pid $DAEMON $NAME && exit 0 || exit $?
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0

答案2

您是否尝试过删除该文件rm然后重新安装该软件包?

如果不起作用,您可以尝试aptitude purge删除apt-get remove --purge该包及其所有配置文件。然后再次安装即可得到默认的配置文件。

如果没有任何效果,请尝试.deb从存储库获取该文件(在packages.debian.org 中查找它),然后将其解压两次(首先是包.deb,然后是data.tar.gz将包含在 . 中的文件.deb。您必须找到配置文件那里。

答案3

只需在重新安装之前创建一个空文件

sudo touch /etc/init.d/pure-ftpd-mysql

然后使用 --purge 标志重新安装(它会删除包含此文件的库,并创建一个新的工作文件)

sudo apt-get remove pure-ftpd-mysql --purge

sudo apt-get install pure-ftpd-mysql

相关内容