Ask Command Auto Restart Apache Cpanel


Status
Not open for further replies.

maestro

Poster 2.0
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....
 

PusatHosting

Hosting Guru
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
 

voezie

Hosting Guru
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....

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.
 

maestro

Poster 2.0
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
 

PusatHosting

Hosting Guru
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.

yap benar, cuman nanti setelah ada alert kan langsung cek apa masalahnya dibandingkan server load tinggi terus menerus.
 

PusatHosting

Hosting Guru
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

kalau saya sih di shell aja
 
Status
Not open for further replies.

Top