ムムム。
どうもH2Oをrestartするとstopはできるのだがstartはできない。。(CentOS)
ちなみにrpmからインストールすると以下のinitファイルが確認できると思う。
https://github.com/tatsushid/h2o-rpm/blob/master/rpmbuild/SOURCES/h2o.init
・yumrepoでインストールしたい場合は以下
https://github.com/tatsushid/h2o-rpm
1 2 3 4 5 6 7 8 9 10 11 | # vim /etc/yum.repos.d/bintray-tatsushid-h2o-rpm.repo #bintray-tatsushid-h2o-rpm - packages by tatsushid from Bintray [bintray-tatsushid-h2o-rpm] name=bintray-tatsushid-h2o-rpm #If your system is CentOS baseurl=https://dl.bintray.com/tatsushid/h2o-rpm/centos/$releasever/$basearch/ #If your system is Amazon Linux #baseurl=https://dl.bintray.com/tatsushid/h2o-rpm/centos/6/$basearch/ gpgcheck=0 repo_gpgcheck=0 enabled=1 |
というわけで1からinitファイルを作ってみました。
■h2o dead but subsys locked
1 2 3 4 5 6 7 8 9 10 11 | # /etc/init.d/h2o restart Stopping h2o: [ OK ] Starting h2o: # /etc/init.d/h2o status h2o dead but subsys locked # /etc/init.d/h2o restart Stopping h2o: [FAILED] Starting h2o: start_server (pid:9821) starting now... [ OK ] |
面白いのが日によってrestartできたりできなかったりがあるということw
dead but subsys lockedはlockファイルが残ったままサービスが停止している状態。
しかし、非公式のinitファイルにはちゃんとlockファイルが消すように作られているのだが、
ナゼ……
ちなみにUbuntuは問題ない。
■centos_h2o.init
#!/bin/bash | |
#chkconfig: 2345 85 15 | |
#descpriction: h2o Web Server | |
# source function library | |
. /etc/rc.d/init.d/functions | |
RETVAL=0 | |
SERVICE_NAME=`basename $0` | |
start() { | |
echo -n $"Starting $SERVICE_NAME: " | |
/usr/sbin/h2o -m daemon -c /etc/h2o/h2o.conf | |
RETVAL=$? | |
if [ $RETVAL == 0 ]; then | |
success | |
else | |
failure | |
fi | |
echo | |
} | |
stop() { | |
echo -n $"Stopping $SERVICE_NAME: " | |
kill -TERM `cat /var/run/h2o/h2o.pid` | |
RETVAL=$? | |
if [ $RETVAL == 0 ]; then | |
success | |
else | |
failure | |
fi | |
echo | |
} | |
reload() { | |
echo -n $"Graceful $SERVICE_NAME: " | |
kill -HUP `cat /var/run/h2o/h2o.pid` | |
RETVAL=$? | |
if [ $RETVAL == 0 ]; then | |
success | |
else | |
failure | |
fi | |
echo | |
} | |
configtest() { | |
/usr/sbin/h2o -t -c /etc/h2o/h2o.conf | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status -p /var/run/h2o/h2o.pid | |
RETVAL=$? | |
;; | |
reload|graceful) | |
reload | |
;; | |
configtest) | |
configtest | |
RETVAL=$? | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo $"Usage: $0 {start|stop}" | |
exit 1 | |
esac | |
exit $RETVAL |
これでうまく動いた。
・確認
1 2 3 4 5 6 7 8 9 | # /etc/init.d/h2o status (pid 15761) is running... # /etc/init.d/h2o restart Stopping h2o: [ OK ] Starting h2o: start_server (pid:15806) starting now...[ OK ] # /etc/init.d/h2o status (pid 15808) is running... |
■まとめ
configtestもreloadもできるし問題なし!
reloadはgraceful。
Amazon LinuxとCentOSベース変わらんから大丈夫なはず。
というかパイセンはちゃんとrestartできるけどなぜww
※追記
もしかしたら設定ファイル間違えてるとこういう挙動になるかも。。
0件のコメント