PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : proftpd start/stop



robiotor
24.12.02, 10:36
kann mir mal jemand sagen wie ich den proftp dazu bringe das er mit dem hochfahren des rechners gestartet wird. und wie stoppe ich den eigentlich auser den ps zu killen.

der proftpd ist auf redhat 7.3 installiert

screenyfs
24.12.02, 12:06
Mach einen Link darauf in den Ordner vom Runlevel den du benutzt (Bei Debian isses /etc/rcX.d (X steht für eine Zahl)).
[edit]Wenn du startx automatisch startest kannst du es auch in die .xinitrc eintragen

Stormbringer
24.12.02, 12:12
Hi,

ich schätze einmal, daß es bei dem ersten Teil der Frage darauf ankommt, in welchem Modus proFTPD gestartet werden soll: als standalone oder per (x)inetd.
Für den standalone-Modus muß ein Start/STopskriopt existieren in /etc/init.d/%runlevel%, für den (x)inetd-Modus muß halt entsprechend ein Eintrag in der /etc/(x)inetd.conf vorhanden sein.
Auch der zweite Teil der Frage ist vom Modus abhängig.
Entweder es funzt ein:
/etc/init.d/proftpd stop
oder aber ein /etc/init.d/xinetd stop (dabei werden dann aber temporär erst einmal alle per xinetd gestarteten Dienste angehalten), dann kannst Du den betreffenden Eintrag entfernen/auskommentieren, und xinetd erneut starten.

Aber i. d. R. muß ein Dienst ja nicht gesondert beendet/gestartet werden ... ;-)

Gruß

robiotor
24.12.02, 12:22
also Stormbinder, ich möchte das der proftpd im Standalone mode gestartet wird, ja am besten mit einem start/stop script

also mein rechner leuft im runlevel 5 dh. ich muss ja die startstop scripte auch dort rein tun in meinem fall /etc/rc.d/rc5.d/S99scriptname und /etc/rc.d/rc5.d/K99scriptname

das proftpd tuhe ich in /etc/rc.d/init.d

aber wie schauen diese scripte aus? kannst mir mal eventuel da helfen ?

fröhliche wihnachten dir Stormbinder

robiotor
24.12.02, 12:23
nee ein dienst muss nicht in der regel gestopt werden aber ich hätte das so wie beim apache das ich das starten/stopen kann.

Stormbringer
24.12.02, 13:04
Hallo,

ich poste hier einfach einmal die /etc/init.d/proftpd (RedHat8 Skript für proFTPD 1.2.7).


#!/bin/sh
#
# Startup script for ProFTPd
#
# chkconfig: 345 85 15
# description: ProFTPD is an enhanced FTP server with \
# a focus toward simplicity, security, and ease of configuration. \
# It features a very Apache-like configuration syntax, \
# and a highly customizable server infrastructure, \
# including support for multiple 'virtual' FTP servers, \
# anonymous FTP, and permission-based directory visibility.
# processname: proftpd
# config: /etc/proftpd.conf
#
# By: Osman Elliyasa <osman@Cable.EU.org>
# $Id: proftpd.init.d,v 1.6 2002/11/23 05:20:52 jwm Exp $

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/proftpd ]; then
. /etc/sysconfig/proftpd
fi

PATH="$PATH:/usr/local/sbin"
FTPSHUT=/usr/sbin/ftpshut

# See how we were called.
case "$1" in
start)
echo -n "Starting proftpd: "
daemon proftpd $OPTIONS
echo
touch /var/lock/subsys/proftpd
;;
stop)
echo -n "Shutting down proftpd: "
killproc proftpd
echo
rm -f /var/lock/subsys/proftpd
;;
status)
status proftpd
;;
restart)
$0 stop
$0 start
;;
reread)
echo -n "Re-reading proftpd config: "
killproc proftpd -HUP
echo
;;
suspend)
if [ -f $FTPSHUT ]; then
if [ $# -gt 1 ]; then
shift
echo -n "Suspending with '$*' "
$FTPSHUT $*
else
echo -n "Suspending NOW "
$FTPSHUT now "Maintanance in progress"
fi
else
echo -n "No way to suspend "
fi
echo
;;
resume)
if [ -f /etc/shutmsg ]; then
echo -n "Allowing sessions again "
rm -f /etc/shutmsg
else
echo -n "Was not suspended "
fi
echo
;;
*)
echo -n "Usage: $0 {start|stop|restart|status|reread|resume"
if [ "$FTPSHUT" = "" ]; then
echo "}"
else
echo "|suspend}"
echo "suspend accepts additional arguments which are passed to ftpshut(8)"
fi
exit 1
esac

if [ $# -gt 1 ]; then
shift
$0 $*
fi

exit 0


Und in den folgenden runlevels sollten links auf das Start/Stop Skript (etc/init.d/proftpd) liegen:
/etc/rc.d/init.d/proftpd
/etc/rc.d/rc0.d/K15proftpd
/etc/rc.d/rc1.d/K15proftpd
/etc/rc.d/rc2.d/K15proftpd
/etc/rc.d/rc3.d/S85proftpd
/etc/rc.d/rc4.d/S85proftpd
/etc/rc.d/rc5.d/S85proftpd
/etc/rc.d/rc6.d/K15proftpd

Gruß

robiotor
24.12.02, 14:02
Hallo Stormbringer

vielen dank für das script, es funktioniert. Ich habe es dafür ein wenig geändert weil ich redhat 7.3 habe und ich das proftpd selber compiliert habe mit --prefix=/usr/local/proftpd


also ich beschreibe wie ich das nun gemacht habe für alle die die auf der suche dannach sind wie sie den proftpd beim hochfahren des systems automatisch zu starten, bzw. wie sie den proftpd beenden können.


es handelt sich um proftpd-1.2.7.tar.gz mit anderen versionen habe ich das nicht ausprobiert


das folgende script abspeichern in /etc/init.d/proftpd


#!/bin/sh
#
# Startup script for ProFTPd
#
# chkconfig: 345 85 15
# description: ProFTPD is an enhanced FTP server with \
# a focus toward simplicity, security, and ease of configuration. \
# It features a very Apache-like configuration syntax, \
# and a highly customizable server infrastructure, \
# including support for multiple 'virtual' FTP servers, \
# anonymous FTP, and permission-based directory visibility.
# processname: proftpd
# config: /etc/proftpd.conf
#
# By: Osman Elliyasa <osman@Cable.EU.org>
# $Id: proftpd.init.d,v 1.6 2002/11/23 05:20:52 jwm Exp $

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/proftpd ]; then
. /etc/sysconfig/proftpd
fi

PATH="$PATH:/usr/local/sbin"
FTPSHUT=/usr/sbin/ftpshut

# See how we were called.
case "$1" in
start)
echo -n "Starting proftpd: "
daemon proftpd $OPTIONS
echo
touch /var/lock/subsys/proftpd
;;
stop)
echo -n "Shutting down proftpd: "
killproc proftpd
echo
rm -f /var/lock/subsys/proftpd
;;
status)
status proftpd
;;
restart)
$0 stop
$0 start
;;
reread)
echo -n "Re-reading proftpd config: "
killproc proftpd -HUP
echo
;;
suspend)
if [ -f $FTPSHUT ]; then
if [ $# -gt 1 ]; then
shift
echo -n "Suspending with '$*' "
$FTPSHUT $*
else
echo -n "Suspending NOW "
$FTPSHUT now "Maintanance in progress"
fi
else
echo -n "No way to suspend "
fi
echo
;;
resume)
if [ -f /etc/shutmsg ]; then
echo -n "Allowing sessions again "
rm -f /etc/shutmsg
else
echo -n "Was not suspended "
fi
echo
;;
*)
echo -n "Usage: $0 {start|stop|restart|status|reread|resume"
if [ "$FTPSHUT" = "" ]; then
echo "}"
else
echo "|suspend}"
echo "suspend accepts additional arguments which are passed to ftpshut(8)"
fi
exit 1
esac

if [ $# -gt 1 ]; then
shift
$0 $*
fi

exit 0




ACHTUNG: dei zeilen ziemlich oben im script PATH="$PATH:/usr/local/sbin"
FTPSHUT=/usr/sbin/ftpshut ändern in PATH="$PATH:/usr/local/proftpd/sbin"
FTPSHUT=/usr//local/proftpd/sbin/ftpshut

wenn ihr den proftpd auch mit --prefix=/usr/local/proftpd installiert habt, ansonsten anpassen halt

nun macht ihr ein chmod +x /etc/init.d/proftpd als root

nun überprüft auf welchen runlevel euer rechner leuft mit runlevel, als ausgabe bekommt ihr so in etwa N 5 dh. mein rechner läuft also im runlevel 5

also erstelle ich nun zwei links dort wie folgt

cd /etc/rc.d/rc5.d
ln -s ../init.d/proftpd S85proftpd
ln -s ../init.d/proftpd K85proftpd

bzw. ihr in dem entsprechenden runlevel die rcX.d bezeichnet den runlevel


proftpd startet jetzt jedes mal wenn ihr den rechner hochfährt als Standalone beenden könnt ihr in mit /etc/rc.d/rc5.d/K85proftpd stop

solltet ihr in wieder starten wollen dann mit /etc/rc.d/rc5.d/S85proftpd start


vielen dank an Stormbringer und nochmal fröhliche weihnachten

ich hoffe ich habe nicht so viele rechtschreib fehler gemacht :)