Hack Server Linux - Cara menyiapkan Shell Script ke Auto Restart Apache HTTPD Server!
Yah, aku telah berjuang dengan salah satu dedicated server dan hanya menemukan script yang sejuk ini akan terisi secara otomatis me-restart Apache httpd server jika keluar.
Simpan sebagai restart.sh berikut:
#! / bin / bash # Apache Proses Monitor # Restart Apache Web Server When It Goes Down # ------------------------------------------------- ------------------------ nixCraft project <http://cyberciti.biz/fb/> # Copyright (c) 2003 nixCraft proyek <http://cyberciti.biz/fb/> # Script ini berlisensi di bawah GNU GPL versi 2.0 atau di atas # ------------------------------------------------- ------------------------ # Script ini merupakan bagian dari koleksi nixCraft shell script (NSSC) # Kunjungi http://bash.cyberciti.biz/ untuk informasi lebih lanjut. # ------------------------------------------------- ------------------------ # RHEL / CentOS / Fedora Linux perintah restart Restart = "/ sbin / service httpd restart" # Tanda komentar jika anda menggunakan Debian / Ubuntu Linux # Restart = "/ etc/init.d/apache2 restart" # path ke perintah pgrep PGREP = "/ usr / bin / pgrep" # Httpd daemon nama, # Di bawah RHEL / CentOS / Fedora itu adalah httpd # Under Debian 4. X itu adalah apache2 HTTPD = "httpd" # Find httpd pid $ PGREP $ (HTTPD) $? if [$? # if apache not running -ne 0] # jika apache tidak berjalan kemudian # Restart apache $ Restart fi
Kemudian setup sebuah tugas cron seperti ini: (biasanya dalam sa-update file di / etc / cron.d)
* / 5 * * * * * root / root / restart.sh> / dev / null 2> & 1
Ada juga sebuah program yang disebut Monit yang akan berbuat lebih banyak otomatisasi.
Tingkat
Tags: amp, apache httpd server, web server apache, script keren, dedicated server, fb, fedora, fi, gnu gpl versi, Linux, linux server, lt, root root, koleksi script, server hack, shell script, Ubuntu
Kategori: Blog, HOWTO, Hack, Lain-lain, Web, Wordpress.













