2015年5月18日 星期一

Kill Apache server and get error, "httpd dead but subsys locked"


Problem

當使用 apachectl stop  去 shutdown 此 Apache server 時,再以 service httpd status  檢視時,系統出現錯誤訊息: httpd dead but subsys locked 

Study

剛開始研判,由網路搜尋解決方法時,會誤判 Disk 容量不夠,需清理。但, /u01 (或 /ora03) 仍有 103M ,應該足夠

# df -h
Filesystem                             Size  Used   Avail Use%  Mounted on
/dev/mapper/VolGroup00-LogVol00        38G   4.5G   32G   13%   /
/dev/sda1                              99M   16M    79M   17%   /boot
tmpfs                                  4.0G  0      4.0G  0%    /dev/shm
/dev/mapper/VolGroup00-LogVol02        40G   22G    16G   58%   /ora01
/dev/mapper/VolGroup00-LogVol03        5.0G  631M   4.1G  14%   /misap
/dev/mapper/VolGroup00-LogVol05        9.9G  1.4G   8.0G  15%   /var
/dev/mapper/VolGroup01-LogVol05        352G  337G  103M   100%  /ora03
/dev/mapper/VolGroup01-LogVol05        352G  337G  103M   100%  /u01
但,事實上參考 [1] 時,問題可獲解決。 Solution 1. 更改 /etc/httpd/conf/httpd.conf 檔案

# cd /etc/httpd/conf
# vi httpd.conf

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
#PidFile run/httpd.pid
PidFile /var/run/httpd.pid  <== 修改後
2. 更改 /etc/sysconfig/httpd 檔案

# cd /etc/sysconfig/
# vi httpd

# Configuration file for the httpd service.

#
# The default processing model (MPM) is the process-based
# 'prefork' model.  A thread-based model, 'worker', is also
# available, but does not work with some modules (such as PHP).
# The service must be stopped before changing this variable.
#
#HTTPD=/usr/sbin/httpd.worker

#
# To pass additional options (for instance, -D definitions) to the
# httpd binary at startup, set OPTIONS here.
#
#OPTIONS=

#
# By default, the httpd process is started in the C locale; to
# change the locale in which the server runs, the HTTPD_LANG
# variable can be set.
#
#HTTPD_LANG=C

PIDFILE=/var/run/httpd.pid <== 新增
3. 確認所有 Apache Server 都清除

# killall -9 httpd
httpd: no process killed
4. 將被鎖住的檔案 httpd 刪除

# cd /var/lock/subsys
# ls
acpid         cups       hpssd.py       network    smartd     xinetd
atd           gpm        httpd          nfslock    smb        yum-updatesd
auditd        haldaemon  kudzu          pcscd      sm-client
autofs        hcid       local          portmap    sshd
avahi-daemon  hidd       messagebus     rpcidmapd  syslog
bluetooth     hpiod      microcode_ctl  sdpd       winbindd
crond         hplip      netfs          sendmail   xfs
# rm httpd
rm: remove regular empty file `httpd'? y
5. 重啟 Apache server

# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd:                                            [  OK  ]
6. 確認 Apache server 是否啟動

# service httpd status
httpd (pid 5328 5327 5326 5325 5324 5323 5322 5321 5319) is running...
Reference 1. http://serverfault.com/questions/560282/still-httpd-dead-but-subsys-locked-even-following-the-fix-of-some-source (1) Had to change httpd.config in /etc/httpd/conf/ from: PidFile run/httpd.pid to: PidFile /var/run/httpd.pid (2) Also, changed httpd file in /etc/sysconfig/ from: PIDFILE=/var/run/httpd/httpd.pid to: PIDFILE=/var/run/httpd.pid (3) Run the following comand: killall -9 httpd (4) then, to remove httpd lock: rm -f /var/lock/subsys/httpd (5) And restarted Apache: service httpd restart 2. http://www.tecmint.com/how-to-check-disk-space-in-linux/

沒有留言:

張貼留言

prettyPrint();