简体   繁体   中英

Upstart script for HHVM/Hiphop

I'm trying to setup an upstart for HHVM aka Hiphop PHP on an Ubuntu 13.04 server, so it launches at startup and gets respawned when terminated unexpectedly.

The script is in:

/etc/init/hhvm.conf

This is what I've got so far:

# Upstart HHVM script
# This script will start/stop HHVM webserver

description "Start and stop the HHVM webserver (Hiphop-PHP)"
version "0.1"
author "RouteXL.com"

# Set the executable and the settings files
env RUN=/usr/share/hhvm/hiphop-php/hphp/hhvm/hhvm
env CONFIG=/etc/hhvm.hdf

# Run at startup when ready
start on (local-filesystems and net-device-up IFACE!=lo)

# Stop the webserver when server closes down
stop on runlevel [016]

# Respawn th webserver when unexpectedly stopped
respawn

# Expect the process to fork
expect fork
expect daemon

# The command to execute to start it up
exec $RUN -m server -c $CONFIG

Nothing happens when I enter:

sudo start hhvm

What's wrong?

Ubuntu 12.04. I modeled this after the sshd.conf and it seems to work. I suspect it's because you're using -m server which causes it never to return from the exec. Use -m daemon. YMMV

# hhvm - HipHop VM
#
# The HipHopVM server provides a high performance PHP stack and web server.

description     "HHVM server"
author "Yermo Lamers http://twitter.com/yermolamers"

start on filesystem or runlevel [2345]
stop on runlevel [!2345]

respawn
respawn limit 10 5
umask 022

# Location of config and executable

env SERVER=/usr/local/bin/hhvm
env CONFIG_FILE=/usr/local/etc/hhvm.hdf
env RUN_AS=www-data

exec $SERVER -m daemon --config $CONFIG_FILE --user $RUN_AS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM