Newbie cry for help!

Discussion in 'Server Operation' started by baldur2630, Jan 23, 2008.

  1. baldur2630

    baldur2630 New Member

    I decided to install ProFTPD Admin. To do this, I had to first remove the old rpm version and then download the source and recompile it with MySQL support.

    It all worked beautifully, I was very proud of myself, ProFTPD and the admin module is perfect.

    So what's the problem?

    I can start ProFTPD manually. I tried to use chkconfig to add it to the services and it says operation not supported..

    How do I add ProFTPD standalone to the Services so it starts when the box is booted and I can stop and restart it? It's a Fedora 8 Server
     
    Last edited: Jan 23, 2008
  2. topdog

    topdog HowtoForge Supporter

    You need to install and init script for it, then chkconfig will work. Am sure that the init script from your old rpm should work unless the paths for the compiled version are different but am sure you can fix that.
     
  3. baldur2630

    baldur2630 New Member

    I created the following script and put it into /etc/init.d but that doesn't seem to work. What am I missing?

    #!/bin/sh

    # ProFTPD files

    FTPD_BIN=/usr/local/sbin/proftpd
    FTPD_CONF=/usr/local/etc/proftpd.conf
    PIDFILE=/var/run/proftpd.pid

    # If PIDFILE exists, does it point to a proftpd process?

    if [ -f $PIDFILE ]; then
    pid=`cat $PIDFILE`
    fi

    if [ ! -x $FTPD_BIN ]; then
    echo "$0: $FTPD_BIN: cannot execute"
    exit 1
    fi

    case $1 in

    start)

    if [ -n "$pid" ]; then
    echo "$0: proftpd [PID $pid] already running"
    exit
    fi

    if [ -r $FTPD_CONF ]; then
    echo "Starting proftpd..."
    $FTPD_BIN -c $FTPD_CONF
    else
    echo "$0: cannot start proftpd -- $FTPD_CONF missing"
    fi
    ;;

    stop)

    if [ -n "$pid" ]; then
    echo "Stopping proftpd..."
    kill -TERM $pid
    else
    echo "$0: proftpd not running"
    exit 1
    fi
    ;;

    restart)
    if [ -n "$pid" ]; then
    echo "Rehashing proftpd configuration"
    kill -HUP $pid
    else
    echo "$0: proftpd not running"
    exit 1
    fi
    ;;

    *)

    echo "usage: $0 {start|stop|restart}"
    exit 1
    ;;

    esac
    exit 0
     
  4. topdog

    topdog HowtoForge Supporter

    I have modified it to work with chkconfig.

    Code:
    #!/bin/sh
    # 
    #
    # proftpd       This shell script takes care of starting and stopping
    #               proftpd.
    #
    # chkconfig: - 80 30
    # description: ProFTPd is an enhanced FTP server with a focus towards
    #
      FTPD_BIN=/usr/local/sbin/proftpd
      FTPD_CONF=/usr/local/etc/proftpd.conf
      PIDFILE=/var/run/proftpd.pid
    
    # If PIDFILE exists, does it point to a proftpd process?
    
     if [ -f $PIDFILE ]; then
        pid=`cat $PIDFILE`
     fi
    
     if [ ! -x $FTPD_BIN ]; then
       echo "$0: $FTPD_BIN: cannot execute"
       exit 1
     fi
    
     case $1 in
    
       start)
    
      if [ -n "$pid" ]; then
           echo "$0: proftpd [PID $pid] already running"
           exit
      fi
    
      if [ -r $FTPD_CONF ]; then
          echo "Starting proftpd..."
          $FTPD_BIN -c $FTPD_CONF
      else
          echo "$0: cannot start proftpd -- $FTPD_CONF missing"
      fi
      ;;
    
      stop)
    
        if [ -n "$pid" ]; then
           echo "Stopping proftpd..."
           kill -TERM $pid
       else
           echo "$0: proftpd not running"
           exit 1
       fi
       ;;
    
        restart)
         if [ -n "$pid" ]; then
            echo "Rehashing proftpd configuration"
            kill -HUP $pid
         else
           echo "$0: proftpd not running"
           exit 1
        fi
        ;;
    
       *)
    
       echo "usage: $0 {start|stop|restart}"
       exit 1
       ;;
    
       esac
       exit 0
    
     
  5. baldur2630

    baldur2630 New Member

    OK, it's now showing as a Service BUT...

    proftpd: unrecognized service
     
  6. topdog

    topdog HowtoForge Supporter

    When does that error show up ? Is it when you run
    Code:
    service proftpd start 
    
    This is what happens on my side but its simply due to the fact that i dont have proftpd installed in that location.
    Code:
    [root@tdss ~]# chkconfig --level 345 proftpd on
    [root@tdss ~]# service proftpd start
    /etc/init.d/proftpd: /usr/local/sbin/proftpd: cannot execute
    
     
    Last edited: Jan 23, 2008
  7. baldur2630

    baldur2630 New Member

    I did chkconfig --level 345 proftpd on and then went to the Service Panel and that is what is showing.

    If I click restart or stop or start, nothing changes. I haven't tried service proftpd stop or start, because it was (is) in use and I didn't want to kick anyone off.

    Do you think service proftpd restart from the command line will sort it out?
     
  8. topdog

    topdog HowtoForge Supporter

    Yes test that, am not using ispconfig so i am not able to see what is causing that error.
     

Share This Page