Added upstart script

This commit is contained in:
Peter Šurda 2016-08-21 07:46:53 +02:00
parent 8df8d15cba
commit fe97c58222
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

37
upstart/bitmessage.conf Normal file
View File

@ -0,0 +1,37 @@
# This is an upstart script for bitmessage for when using daemon mode
# Bitmessage forks more than twice before daemonizing, so a workaround is
# necessary
description "bitmessage"
author "Peter Surda"
start on (local-filesystems and net-device-up)
stop on runlevel [!2345]
setuid bitmessage
setgid bitmessage
chdir /home/bitmessage
env HOME="/home/bitmessage"
pre-start script
/usr/src/PyBitmessage/src/bitmessagemain.py
end script
script
while [ ! -f $HOME/.config/PyBitmessage/singleton.lock ]; do
sleep 1
done
while [ -f $HOME/.config/PyBitmessage/singleton.lock ]; do
sleep 1
done
end script
post-stop script
if [ -f $HOME/.config/PyBitmessage/singleton.lock ]; then
pid=`lsof -F p $HOME/.config/PyBitmessage/singleton.lock|cut -b2-`
if [ -n "$pid" ]; then
kill $pid
fi
fi
end script