diff options
Diffstat (limited to 'testing/atheme-iris/atheme-iris.initd')
-rwxr-xr-x | testing/atheme-iris/atheme-iris.initd | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/testing/atheme-iris/atheme-iris.initd b/testing/atheme-iris/atheme-iris.initd index e0b371c79..4ac170846 100755 --- a/testing/atheme-iris/atheme-iris.initd +++ b/testing/atheme-iris/atheme-iris.initd @@ -2,41 +2,38 @@ # Copyright 2013 Alpine Linux # Distributed under the terms of the GNU General Public License v2 -extra_stopped_commands="setup" +extra_stopped_commands="compile" + +: ${SVCHOME:=/var/lib/$SVCNAME} +: ${pidfile:=/var/run/${SVCNAME%%.*}/${SVCNAME#*.}.pid} depend() { use net need localmount } - -setup() { - ebegin "Setting up ${SVCNAME}" - cd /var/lib/atheme-iris - python ./clean.py - python ./compile.py - echo "atheme-iris has been compiled succesfully." - echo "Now you can start the daemon with /etc/init.d/atheme-iris start" +compile() { + ebegin "Compiling configuration for ${SVCNAME}" + cd ${SVCHOME} + ./clean.py + ./compile.py eend $? } start() { + compile || return 1 + checkpath --directory --owner iris ${pidfile%/*} ebegin "Starting ${SVCNAME}" - if [ -f /var/lib/atheme-iris/.compiled ]; then - cd ${SVCHOME} - nohup python ./run.py ${ARGS} &>/dev/null & - else - eerror "You must first run /etc/init.d/atheme-iris setup" - fi - setup() - eend $? -} + start-stop-daemon --exec ${SVCHOME}/run.py \ + --pidfile $pidfile \ + --chdir $SVCHOME \ + --user iris:iris \ + --background \ + --stdout /dev/null \ + --stderr /dev/null \ + --wait 500 \ + -- \ + -P $pidfile \ + $ARGS -stop() { - ebegin "Stopping ${SVCNAME}" - if [ -f /var/run/atheme-iris/atheme-iris.pid ]; then - kill $(cat /var/run/atheme-iris/atheme-iris.pid) - else - eerror "atheme-iris is not running." - fi eend $? } |