Apache2 don't start /var/www/sharedip don't exist

Discussion in 'General' started by Dr.Oetker, Apr 8, 2007.

  1. Dr.Oetker

    Dr.Oetker New Member

    ISPConfig runs with out problems, but today the sites not online.

    I try to restart the apache2 server and got this error:

    Whats wrong? Why it works yesterday and now /var/www/sharedip is away?

    How can I fix it?

    Pleace help me!
     
  2. Dr.Oetker

    Dr.Oetker New Member

    Okay, i have restart the server and now it works, but the directory /var/www/sharedip does not exist!?
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig creates the /var/www/sharedip during setup and does not touch the directory afterwards.

    Please create the directory manually. Are there any errrs in the file /home/admispconfig/ispconfig/ispconfig.log?
     
  4. Dr.Oetker

    Dr.Oetker New Member

    I have created the sharedip directory and checked the ISPConfig Log. There are no errors.

    After the Reboot all workes fine, but yesterday, the apache2 goes down and restart dosnt work:

    I have rebooted the server, now it works :confused:
     
  5. Dr.Oetker

    Dr.Oetker New Member

    Today the apache2 server goes down again.

    And it works again after a reboot.
    But i wont (and i cant) restart the server every ~ 6 days! What is wrong?

    I have looked at the ispconfig. Before the server goes down, there are the following lines:

    The same before the last crash:


    But what is the problem? Pleace help me!

    (sorry for me bad english, im from germany)
     
  6. falko

    falko Super Moderator Howtoforge Staff

    What's in the Apache init script in /etc/init.d? Which distribution do you use?
     
  7. Dr.Oetker

    Dr.Oetker New Member

    my apache2 init.d file:

    Code:
    #!/bin/sh -e
    #
    # apache2               This init.d script is used to start apache2.
    #                       It basically just calls apache2ctl.
    
    ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
    
    #[ `ls -1 /etc/apache2/sites-enabled/ | wc -l | sed -e 's/ *//;'` -eq 0 ] && \
    #echo "You haven't enabled any sites yet, so I'm not starting apache2." && \
    #echo "To add and enable a host, use addhost and enhost." && exit 0
    
    #edit /etc/default/apache2 to change this.
    NO_START=0
    
    set -e
    if [ -x /usr/sbin/apache2 ] ; then
            HAVE_APACHE2=1
    else
            exit 0
    fi
    
    test -f /etc/default/rcS && . /etc/default/rcS
    test -f /etc/default/apache2 && . /etc/default/apache2
    if [ "$NO_START" != "0" -a "$1" != "stop" ]; then
            [ "$VERBOSE" != no ] && echo "Not starting apache2 - edit /etc/default/apache2 and change NO_START to be 0.";
            exit 0;
    fi
    
    APACHE2="$ENV /usr/sbin/apache2"
    APACHE2CTL="$ENV /usr/sbin/apache2ctl"
    
    apache_stop() {
            PID=""
            PIDFILE=""
            # let's try to find the pid file
            # apache2 allows more than PidFile entry in the config but only
            # the last found in the config is used
            for PFILE in `grep ^PidFile /etc/apache2/* -r | awk '{print $2}'`; do
    
                    PIDFILE="$PFILE"
                    if [ -e "$PIDFILE" ]; then
                            PID=`cat $PIDFILE`
                    fi
            done
    
            if `apache2 -t > /dev/null 2>&1`; then
                    # if the config is ok than we just stop normaly
    
                    if [ -e "$PIDFILE" ]
                    then
                            PID=`cat $PIDFILE`
    
                            $APACHE2 -k stop
    
                            CNT=0
                            while [ 1 ]
                            do
                                    CNT=$(expr $CNT + 1)
    
                                    [ ! -d /proc/$PID ] && break
    
                                    if [ $CNT -gt 60 ]
                                    then
                                            echo " ... failed!"
                                            echo "Apache2 failed to honor the stop command, please investigate the situation by hand."
                                            exit 1
                                    fi
    
                                    sleep 1
                            done
                    else
                            echo -n " ... no pidfile found! not running?"
                    
    
    fi
    
            else
                    # if we are here something is broken and we need to try
                    # to exit as nice and clean as possible
    
                    # if pidof is null for some reasons the script exits automagically
                    # classified as good/unknown feature
                    PIDS=`pidof apache2` || true
    
                    REALPID=0
                    # if there is a pid we need to verify that belongs to apache2
                    # for real
                    for i in $PIDS; do
                            if [ "$i" = "$PID" ]; then
                                    # in this case the pid stored in the
                                    # pidfile matches one of the pidof apache
                                    # so a simple kill will make it
                                    REALPID=1
                            fi
                    done
    
                    if [ $REALPID = 1 ]; then
                            # in this case it is everything nice and dandy
                            # and we kill apache2
                            kill $PID
                    else
                            # this is the worst situation... just kill all of them
                            #for i in $PIDS; do
                            #       kill $i
                            #done
                            # Except, we can't do that, because it's very, very bad
                            echo " ... failed!"
                            echo "You may still have some apache2 processes running.  There are"
                            echo "processes named 'apache2' which do not match your pid file,"
                            echo "and in the name of safety, we've left them alone.  Please review"
                            echo "the situation by hand."
                    fi
            fi
    }
    
    # Stupid hack to keep lintian happy. (Warrk! Stupidhack!).
    case $1 in
            start)
                    [ -f /etc/apache2/httpd.conf ] || touch /etc/apache2/httpd.conf
                    #ssl_scache shouldn't be here if we're just starting up.
                    [ -f /var/run/apache2/ssl_scache ] && rm -f /var/run/apache2/*ssl_scache*
                    echo -n "Starting web server: Apache2"
                    $APACHE2CTL startssl
                    echo "."
            ;;
            stop)
                    echo -n "Stopping web server: Apache2"
                    apache_stop
                    echo "."
            ;;
            reload)
                    echo -n "Reloading web server config..."
                    $APACHE2CTL graceful $2
                    echo "done."
            ;;
            restart | force-reload)
                    echo -n "Forcing reload of web server: Apache2"
                    apache_stop
                    $APACHE2CTL startssl
                    echo "."
            ;;
            *)
                    echo "Usage: /etc/init.d/apache2 start|stop|restart|reload|force-reload"
            ;;
    esac
    
    My distribution is Debian Sarge 3.1 with ISPConfig 2.2.12
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Your problem seems to occur at 23:59h, that's the time when ISPConfig stops Apache to process the logs and then starts it again. Maybe the problem is that Apache gets started too soon after it has been stopped. You can try to modify the start section of the init script like this:

    Code:
            start)
                    [ -f /etc/apache2/httpd.conf ] || touch /etc/apache2/httpd.conf
                    #ssl_scache shouldn't be here if we're just starting up.
                    [ -f /var/run/apache2/ssl_scache ] && rm -f /var/run/apache2/*ssl_scache*
                    echo -n "Starting web server: Apache2"
                    [B][COLOR="Red"]sleep 3[/COLOR][/B]
                    $APACHE2CTL startssl
                    echo "."
            ;;
     
  9. Dr.Oetker

    Dr.Oetker New Member

    I have added "sleep 3", now i hope, the server dont crash any more *g*

    (The next time should be the 29th, right?)

    thank you!
     
  10. Dr.Oetker

    Dr.Oetker New Member

    Yesterday it was the Same procedure as every weak.

    The Apache goes down and i cant restart him until i reboot the server.
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    You say that this happens only once a week? Thats a bit strannge because ISPConfig does not run any scripts once a week, all scripts are run daily. You should check your crontab and cron.weekly scripts for scripts that where started once a week.
     
  12. Dr.Oetker

    Dr.Oetker New Member

    In the crontab are all ISPConfig Crons:

    Code:
    #ISPConfig Cronjobs
    30 00 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/logs.php &> /dev/null
    59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/ftp_logs.php &> /dev/null
    59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/mail_logs.php &> /dev/null
    59 23 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/cleanup.php &> /dev/null
    0 4 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/webalizer.php &> /dev/null
    0,30 * * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/check_services.php &> /dev/null
    15 3,15 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/quota_msg.php &> /dev/null
    40 00 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/traffic.php &> /dev/null
    05 02 * * * /root/ispconfig/php/php /root/ispconfig/scripts/shell/backup.php &> /dev/null
    

    in the cron.weekly are

    man-db
    ntp-server and
    sysklogd


    The ISPConfig Log says after every crash

    Code:
    INFO - /root/ispconfig/scripts/shell/mail_logs.php, Line 134: rm -f /var/log/mail.log.XX-XX-07_23-59-01
    (XX-XX for the date)
     
  13. Dr.Oetker

    Dr.Oetker New Member

    23:59: Same procedure as every weak, the apache server goes down...
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    As I mentiones earlier in the thread, there is nothing in ISPConfig that is run weekly and your installation seems the only one that has these problems. So I'am pretty sure that the problem is related to a script or process that does not belong to ISPConfig. All ISPConfig scripts where run daily, if the problem woild be caused by ISPConfig, you apache server would die every night and not once a week.
     
  15. Dr.Oetker

    Dr.Oetker New Member

    okay, but the problem is since ISPConfig is installed.

    But how can i find out which cron or application make this crash?

    Thanks for your help!
     

Share This Page