Linux Server Hack - Hoe je een shell-script op Auto Restart Apache HTTPD Server!
Nou, ik heb al moeite met een van mijn dedicated servers en net vonden deze coole script dat wordt automatisch herstart de Apache httpd server als het gaat uit.
Sla de volgende als restart.sh:
#! / bin / bash # Apache Process Monitor # Herstart Apache Web Server When It Goes Down # ------------------------------------------------- ------------------------ nixCraft project <http://cyberciti.biz/fb/> # Copyright (c) 2003 nixCraft project <http://cyberciti.biz/fb/> # Dit script is beschikbaar onder de GNU GPL versie 2.0 of hoger # ------------------------------------------------- ------------------------ # Dit script is onderdeel van nixCraft shell-script collection (NSSC) # Http://bash.cyberciti.biz/ Bezoek voor meer informatie. # ------------------------------------------------- ------------------------ # RHEL / CentOS / Fedora Linux commando restart RESTART = "/ sbin / service httpd restart" # Uncomment als u gebruik maakt van Debian / Ubuntu Linux # RESTART = "/ etc/init.d/apache2 restart" # pad naar pgrep commando Pgrep = "/ usr / bin / pgrep" # Httpd daemon naam, # Onder RHEL / CentOS / Fedora is httpd Onder Debian # 4. X is apache2 HTTPD = "httpd" # Find httpd pid $ $ (Pgrep HTTPD) $? if [$? # if apache not running -ne 0] # Als Apache niet actief dan # Restart apache $ RESTART fi
Dan setup een cron job als dit: (meestal in de sa-update-bestand in / etc / cron.d)
* / 5 * * * * * root / root / restart.sh> / dev / null 2> & 1
Er is ook een programma genaamd Monit dat zal doen meer automatisering.
Tarief
Tags: amp, Apache HTTPD server, Apache-webserver, cool script, dedicated servers, FB, fedora, fi, GNU GPL versie, Linux, linux-server, lt, root root, script collectie, server hacken, shell-script, Ubuntu









