Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gitbucket (for JAR releases from: https://github.com/takezoe/gitbucket, located in /home/ubuntu/gitbucket/gitbucker.war).
#!upstart
description "gitbucket"
env USER=ubuntu
env PID=/var/run/gitbucket.pid
env STDOUT=/var/log/gitbucket/gitbucket.log
env STDERR=/var/log/gitbucket/gitbucket.err
start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]
respawn
console log
script
mkdir -p "$(dirname $STDOUT)"
chown -R $USER:$USER "$(dirname $STDOUT)"
echo $$ > $PID
cd "/home/${USER}/gitbucket"
exec sudo -u "${USER}" java -jar gitbucket.war 1>>$STDOUT 2>>$STDERR
end script
post-stop script
rm -f $PID
exec sleep 5
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment