0

By a mistake... this is my new /etc/init.d/pure-ftpd-mysql:

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

How to install or recover the file? The standard apt-get remove, apt-get install or apt-get install --reinstall pure-ftpd-common pure-ftpd-mysql doesn’t give me that file back.

1

If you have the binary .deb file, you can use Midnight commander (mc) from the shell to just navigate inside and retrieve files from it.

For your convenience, this is the file as found in 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) <racke@linuxia.de>

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
  • Thanks for your answer. hack the .deb... works fine for me. \o/ Have a good weekend! – fruffl Jun 29 '13 at 12:10
0

Have you tried to remove the file with rm and then re-install the package?

If it doesn't work, you can try aptitude purge or apt-get remove --purge to remove the package and all its configuration files. Then, install it again and you will get the default configuration file.

If nothing works, try to get the .deb file from the repo (look fo it in packages.debian.org), and untar it twice (first, the .deb package, and then the data.tar.gz that will be included inside the .deb. You must find the configuration file there.

  • Frankly, I'd suggest opening the deb (with something like mc which does the unpacking transparently for you and can view and copy files out of there) over remove-reinstall, because it's pretty sure to be less-destructive. – Ulrich Schwarz Jun 29 '13 at 11:02
  • @JoseLSegura Thanks for your answer. Yes: I've removed the file before reinstall the package. The installer doesn't create a new copy. I think purge is not the best solution in this case: running system vs. one missing textfile. – fruffl Jun 29 '13 at 12:09
0

just create an empty file before re-installing

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

then reinstall with --purge flag (it removes a library with this file, and creates a new work file)

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

sudo apt-get install pure-ftpd-mysql
  • Welcome to Unix&Linux!  The above essentially duplicates another answer and adds no new content.  Please don’t post an answer unless you actually have something new to contribute.  But also, we’re looking for comprehensive, high-quality answers that provide some explanation and context.  Don’t just give a bunch of sudo commands; explain why your answer is right, ideally with citations, and at the very least with sentences.  Answers that don’t include explanations may be removed. – G-Man May 25 '15 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.