hhvm shell脚本问题

_jerryjee 发布于 2015/06/20 22:50
阅读 214
收藏 0

hhvm自带的脚本不工作,现在自行修改,大家帮忙看下。

#!/bin/bash
#
#       /etc/rc.d/init.d/hhvm
#
# Starts the hhvm daemon
#
# chkconfig: 345 26 74
# description: HHVM (aka the HipHop Virtual Machine) is an open-source virtual machine designed for executing programs written in Hack and PHP
# processname: hhvm

### BEGIN INIT INFO
# Provides: hhvm
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start:  2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop hhvm
# Description: HHVM (aka the HipHop Virtual Machine) is an open-source virtual machine designed for executing programs written in Hack and PHP
### END INIT INFO

# Source function library.
. /etc/init.d/functions

start() {
        echo -n "Starting hhvm: "
        #/usr/bin/hhvm --config /etc/hhvm/server.hdf --user apache --mode daemon
        /usr/bin/hhvm --config /etc/hhvm/server.hdf --user www-data --mode daemon
        touch /var/lock/subsys/hhvm
}

stop() {
        echo -n "Shutting down hhvm: "
        #killproc `cat /var/run/hhvm/pid`   这里原来的脚本
        ps -ef | grep -e hhvm | grep -v grep | awk '{print $2}' | xargs -i kill -9 {}                这里是我自己修改的
        rm -f /var/lock/subsys/hhvm
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        if [ -f "/proc/$(cat /var/run/hhvm.pid 2>/dev/null)" ];then
                echo "hhvm is running"
        else
                echo "hhvm is not running"
        fi
        ;;
    restart)
        stop
        start
        ;;
    reload|condrestart|probe)
        echo "$1 - Not supported."
        ;;
    *)
        echo "Usage: hhvm {start|stop|status|reload|restart[|probe]"
        exit 1
        ;;
esac
exit $?


start,stop单独运行的话是没有问题的。

restart参数修改以后现在是没法启动的:

 /etc/init.d/hhvm restart
Shutting down hhvm: Killed

这里没有执行start启动部分,status状态也检测不了。

大家帮忙看下什么情况。


加载中
0
leo108
leo108

目测是stop的时候把这个脚本自己也kill了,因为这个脚本名字也是hhvm

_
_jerryjee
那么要如何修改呢?
返回顶部
顶部