-
-
Save neutrino/8690944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Sync Gateway Upstart Script” | |
version "0.1.0" | |
author "Nicolas Lapomarda" | |
# Upstart has nothing in $PATH by default | |
env RUNAS=db | |
env HOME=/home/$RUNAS | |
env PATH=$HOME/sync_gateway/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
env PATH_TO_GATEWAY=$HOME/sync_gateway/bin/sync_gateway | |
env PATH_TO_JSON=$HOME/sync_gateway.json | |
env LOGSDIR=$HOME/logs | |
env PIDFILE=/var/run/sync-gateway.pid | |
# Keep the server running on crash or machine reboot | |
start on started mountall | |
stop on shutdown | |
respawn | |
pre-start script | |
mkdir -p $LOGS | |
chown -R $RUNAS:$RUNAS $LOGS | |
end script | |
# Start the Sync Gateway and redirect output streams to log files | |
script | |
# Keep a pid around | |
echo $$ > $PIDFILE | |
exec su -c “$PATH_TO_GATEWAY $PATH_TO_JSON >> $LOGS/sync_access.log 2>> $LOGS/sync_error.log" $RUNAS | |
end script | |
# Remove pid file when we stop the server | |
pre-stop script | |
rm $PIDFILE | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment