Linux Server Hack - Comment installer un script shell pour Auto redémarrer httpd Apache Server!

par Max, le lundi 28 Juillet, 2008

Eh bien, j'ai été aux prises avec un de mes serveurs dédiés et viens de trouver ce script sympa qui sera automatiquement redémarrer le serveur httpd Apache si elle s'éteint.

Sauver ce qui suit comme restart.sh:

 
 #! / bin / bash 
 
 # Apache Process Monitor 
 
 # Redémarrer Apache Web Server When It Goes Down 
 
 # ------------------------------------------------- ------------------------ 
 
  nixCraft project <http://cyberciti.biz/fb/> # Copyright (c) 2003 nixCraft projet <http://cyberciti.biz/fb/> 
 
 # Ce script est sous licence GNU GPL version 2.0 ou supérieur 
 
 # ------------------------------------------------- ------------------------ 
 
 # Ce script est partie de la collection du script shell nixCraft (CNSPM) 
 
 # Visit http://bash.cyberciti.biz/ pour plus d'information. 
 
 # ------------------------------------------------- ------------------------ 
 
 # RHEL / CentOS / Fedora Linux restart 
 
 Restart = "/ sbin / service httpd restart" 

 
 # Décommenter si vous utilisez Debian / Ubuntu Linux 
 
 # Restart = "/ etc/init.d/apache2 restart" 

 
 # path to pgrep commande 
 
 Pgrep = "/ usr / bin / pgrep" 

 
 # Nom de démon httpd, 
 
 # Sous RHEL / CentOS / Fedora il est httpd 
 
 # Sous Debian 4. X, il est apache2 
 
 HTTPD = "httpd" 

 
 # Find httpd pid 
 
 $ Pgrep HTTPD $ () 

 
  $? if [$? 
 # if  apache not running -ne 
0] # Si Apache ne fonctionne pas 
 
 puis 
  
 # Redémarrer Apache 
  
 $ RESTART 
 
 FI 

 

Ensuite, un travail de configuration cron comme ceci: (en général dans votre sa-mise à jour de fichiers sous / etc / cron.d)

* / 5 * * * * root / root / restart.sh> / dev / null 2> & 1

via cyberciti

Il ya aussi un programme appelé Monit qui fera une plus grande automatisation.

Taux

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Chargement ...

Tokyoflash
ad ad
ad ad


20000 GPS POI 9,99 $

Nouvelles et publications connexes

Autres sites intéressants Nouvelles de nos amis

    Commentaires Blog powered by Disqus
    Si vous aimez ce poste alors s'il vous plaît vous abonner à mon flux RSS complet.

    Vous pouvez également vous inscrire par e-mail en remplissant votre nom et e-mail ci-dessous:

    Nom: Email:


    Vous avez un nouveau hack, bricolage, howto, ou gadget? Astuce nous ici.

    Goohack Essayez de trouver un nouveau Hack:


    Featured Sites From Zedomax Blog Network