Ask Command Auto Restart Apache Cpanel

Discussion in 'Software Hosting dan Control Panel' started by maestro, 27 Oct 2010.

Thread Status:
Not open for further replies.
  1. maestro

    maestro Poster 2.0

    Messages:
    144
    Likes Received:
    4
    Trophy Points:
    18
    Saya dapat informasi dari teman cara restart apache yang terlalu over load dengan command sbb:

    Code:
    #!/bin/bash
    # Apache Process Monitor
    # Restart Apache Web Server When It Goes Down
    # -------------------------------------------------------------------------
    # Copyright (c) 2003 nixCraft project <http://cyberciti.biz/fb/>
    # This script is licensed under GNU GPL version 2.0 or above
    # -------------------------------------------------------------------------
    # This script is part of nixCraft shell script collection (NSSC)
    # Visit http://bash.cyberciti.biz/ for more information.
    # -------------------------------------------------------------------------
    # RHEL / CentOS / Fedora Linux restart command
    RESTART="/sbin/service httpd restart"
    
    # uncomment if you are using Debian / Ubuntu Linux
    #RESTART="/etc/init.d/apache2 restart"
    
    #path to pgrep command
    PGREP="/usr/bin/pgrep"
    
    # Httpd daemon name,
    # Under RHEL/CentOS/Fedora it is httpd
    # Under Debian 4.x it is apache2
    HTTPD="httpd"
    
    # find httpd pid
    $PGREP ${HTTPD}
    
    if [ $? -ne 0 ] # if apache not running
    then
     # restart apache
     $RESTART
    fi
    nah pertanyaan saya bagaimana cara script ini dimasukkan ke dalam root shell kita yah?

    Running cron job pada root shell
    */5 * * * * /path/to/script.sh >/dev/null 2>&1

    soalnya cpanel saya klo ga di restart langsung drop

    Mohon bantuannya donk juragan....
     
  2. PusatHosting

    PusatHosting Hosting Guru Web Hosting

    Messages:
    3,334
    Likes Received:
    326
    Trophy Points:
    83
    tinggal di masukan aja di folder tertentu misalkan /etc/script/script.sh di chmod 755 trus bikin cronnya spt yang anda tulis itu diatas.

    script diatas ini untuk restart apache jika down bukan identifikasi berdasarkan load server
     
  3. voezie

    voezie Hosting Guru

    Messages:
    1,771
    Likes Received:
    212
    Trophy Points:
    63
    Sekedar saran Tuan,

    Klo pakek script auto restart gitu hati2, klo gak kepantau tuh server Tuan apache-nya sering restart terus... maksud Tuan mau mengurangi load malah nanti timbul masalah baru yang gak terduga.
     
  4. maestro

    maestro Poster 2.0

    Messages:
    144
    Likes Received:
    4
    Trophy Points:
    18
    saya udah buatkan script.sh didalam direktory
    mkdir /etc/script/
    nano /etc/script/script.sh
    dan udah set chmod 755

    nah untuk buat cron nya seperti tertulis diatas itu penempatannya didalam cpanel atau tetap didalam shell?
    Running cron job pada root shell -> ini pada cpanel or shell yah Tuan?
    */5 * * * * /path/to/script.sh >/dev/null 2>&1

    saya buat seperti ini, dan saya ketikan command ini didalam shell vps
    */5 * * * * /etc/script/script.sh >/dev/null 2>&1


    Mohon revisi dan pencerahannya bro... terima kasih
     
  5. PusatHosting

    PusatHosting Hosting Guru Web Hosting

    Messages:
    3,334
    Likes Received:
    326
    Trophy Points:
    83
    yap benar, cuman nanti setelah ada alert kan langsung cek apa masalahnya dibandingkan server load tinggi terus menerus.
     
  6. PusatHosting

    PusatHosting Hosting Guru Web Hosting

    Messages:
    3,334
    Likes Received:
    326
    Trophy Points:
    83
    kalau saya sih di shell aja
     
Loading...
Thread Status:
Not open for further replies.

Share This Page

Loading...