1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Automatically restart apache after crash?

Discussion in 'Apache' started by fordP, Oct 11, 2007.

  1. #1
    Is it possible to have apache automatically start after it crashes? I'm having some issues with a server and won't be able to sleep tonight unless I know it's not going to go down while I'm asleep...

    explanation of problem (http://forums.digitalpoint.com/showthread.php?t=509900)

    I figured I would start a new thread for this issue as people may find it helpful and I was surprised that apache doesn't do this on it own, as there is no use in having it stay down after a failure
     
    fordP, Oct 11, 2007 IP
  2. cyanide

    cyanide Peon

    Messages:
    483
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes, I was just going to post in that thread.
    You can try the system integrity monitor which auto-checks your server for downed services and automatically restarts them
     
    cyanide, Oct 11, 2007 IP
  3. fordP

    fordP Peon

    Messages:
    548
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Awesome, installed it. That's exactly what i needed. :):):)
     
    fordP, Oct 11, 2007 IP
  4. LinksCity

    LinksCity Guest

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Install SIM (System Integrity Monitor)

    SIM is a system and services monitor for ‘SysVinit’ systems. It is designed to be intuitive and modular in nature, and to provide a clean and informative status system.

    It does this by consistently verifying that services are online, load averages are in check, and log files are at reasonable sizes. Many other SIM modules sport different and in-depth features to bring a well rounded tool to your disposal to stop otherwise common issues daunting internet hosts.

    Login to your server via SSH as root.

    Type: wget http://www.r-fx.org/downloads/sim-current.tar.gz
    This will download the most current version of SIM (System Integrity Monitor)

    Type: tar -xzvf sim-current.tar.gz
    This will extract the tar.gz file at once.

    The last line should look like "sim-2.5-3/CREDITS" everything before the / is the directory where the script was extracted too.
    Type: cd sim-2.5-3
    where sim-2.5-3 is the directory that SIM was extracted too.

    Type: ./setup -i
    Then press "Enter"
    Then when it says MORE press the "space bar"
    Then press "Enter"
    Then when it syas MORE press the "space bar"

    Now you will press ENTER one more time to do the auto-configuration script for SIM.
    Please note the following config is what I use, and you can change some monitoring services if you choose.

    Where is SIM installed ?
    [/usr/local/sim]:
    Press Enter
    Where should the sim.log file be created ?
    [/usr/local/sim/sim.log]:
    Press Enter
    Max size of sim.log before rotated ? (value in KB)
    [128]:
    Type: 512
    Press Enter
    The larger the file the more SIM (System Integrity Monitor) logs we can view. This is good for looking back.
    Where should alerts be emailed to ? (e.g: root, user@domain)
    [root]:
    Type: youreamil@yourdaomin (One off server would be more secure.)
    Press Enter
    Disable alert emails after how many events, to avoid email flood ?
    (Note: events stats are cleared daily)
    [8]:
    Press Enter
    The below are configuration options for Service modules:
    press return to continue...
    Press Enter
    Auto-restart services found to be offline ? (true=enable, false=disable)
    [true]:
    Press Enter
    Enforce laxed service checking ? (true=enable, false=disable)
    [true]:
    Press Enter
    Disable auto-restart after how many downed service events ?
    (Note: events stats are cleared daily)
    [10]:
    Press Enter
    Enable FTP service monitoring ? (true=enable, false=disable)
    [false]:
    Press Enter
    Enable HTTP service monitoring ? (true=enable, false=disable)
    [false]:
    Type: true
    Press Enter
    Enable DNS service monitoring ? (true=enable, false=disable)
    [false]:
    Type: true (if you are running ensim do not type true just press enter)
    Press Enter
    Enable SSH service monitoring ? (true=enable, false=disable)
    [false]:
    Type: true
    Press Enter
    Enable MYSQL service monitoring ? (true=enable, false=disable)
    [false]:
    Type: true
    Press Enter
    Enable SMTP service monitoring ? (true=enable, false=disable)
    [false]:
    Type: true
    Press Enter
    TCP/IP port that SMTP operates on ?
    [25]:
    Press Enter
    Enable XINET service monitoring ? (true=enable, false=disable)
    [false]:
    Type: true
    Press Enter
    TCP/IP port that any XINET service operates on (e.g: pop3, 110) ?
    [110]:
    Press Enter
    Enable ENSIM service monitoring ? (true=enable, false=disable)
    [false]:
    Press Enter
    Enable PGSQL service monitoring ? (true=enable, false=disable)
    [false]:
    After an unclean HTTP shutdown, semaphore array's may remain allocated
    and cause the service to fall into a looping restart cycle. Using this
    feature clears semaphore arrays on HTTP restart.
    Enable semaphore cleanup ?
    [false]:
    Press Enter
    This is an implamented feature in the http module, its purpose is to
    determine if/when the apache server locks up or otherwise stops
    responding.
    Enable URL aware monitoring ?
    Type: true
    Press Enter
    URL path to a local file ? (exclude HTTP://)
    Note: This URL should be valid and reside on the local server, otherwise
    HTTP will loop restarting
    [127.0.0.1/index.html]:
    Type: site.com/index.html that resides on your local server
    Press Enter
    HTTP log files can grow large and cause the service to crash
    (segfault), this feature will keep the main HTTP logs incheck.
    Enable HTTP log monitor ?
    [false]:
    Press Enter
    MySQL uses a /tmp symlink of its mysql.sock socket file. This
    feature verifies that the symlink exists from the main mysql.sock
    file, and if not it is recreated.
    Enable MySQL Socket correction ?
    [false]:
    Press Enter
    Enable NETWORK monitoring ? (true=enable, false=disable)
    [false]:
    Type: true
    Press Enter
    interface to monitor ?
    [eth0]:
    Press Enter
    Enable LOAD monitor ? (true=enable, false=disable)
    [false]:
    Type: true
    Press Enter
    Load level before status condition 'warning' ?
    [25]:
    Type: 5
    Press Enter
    Load level before status condition 'critical' ?
    [45]:
    Type: 10
    Press Enter
    Enable a global (wall) message at status condition 'warning' & 'critical' ?
    [false]:
    Press Enter
    Renice services at status condition 'warning' or 'critical' ?
    (3 values - warn, crit, false - false=disabled)
    [false]:
    Press Enter
    Stop nonessential services at status condition 'warning' or 'critical' ?
    (3 values - warn, crit, false - false=disabled)
    [false]:
    Press Enter
    Reboot system on status condition 'warning' or 'critical' ?
    (3 values - warn, crit, false - false=disabled)
    [false]:
    Press Enter

    Now the SIM (System Integrity Monitor) has been configured we will add a cron.

    Type: ./setup -c
    If it says "Removed SIM cronjob." then you must type it again.
    Type: ./setup -c
    Now it should say Installed SIM cronjob.
     
    LinksCity, Dec 21, 2009 IP