phantomjsを常駐化させた際のメモ.
initctlの簡単な使い方も記す.
環境
$ cat /etc/redhat-release
CentOS release 6.2 (Final)
phantomjs用ファイルを作成
# vim /etc/init/phantom.conf
description "phantomjs-resident"
author "richasonson"
start on runlevel [2345]
stop on runlevel [016]
exec phantomjs --webdriver=8643 --webdriver-logfile=/tmp/phantom.log
respawn
登録されているupstartを確認
$ initctl list
起動
# initctl start phantom
停止
# initctl stop phantom
状態を確認
$ initctl status phantom
(起動時) phantom start/running, process 4098
(停止時) phantom stop/waiting