aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gentoaster')
-rwxr-xr-xgentoaster37
1 files changed, 10 insertions, 27 deletions
diff --git a/gentoaster b/gentoaster
index 32d7d63..c625b55 100755
--- a/gentoaster
+++ b/gentoaster
@@ -1,35 +1,18 @@
-#!/bin/bash
+#!/sbin/runscript
USER=root
GENTOASTER=/usr/share/gentoaster/daemon.php
-RETVAL=0
+GENTOASTER_PID=/usr/share/gentoaster/gentoaster.pid
+GENTOASTER_LOG=/var/log/gentoaster.log
start() {
- echo "Starting Gentoaster"
- start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/php -- -f $GENTOASTER
- RETVAL=$?
+ ebegin "Starting Gentoaster"
+ start-stop-daemon --start --background --make-pidfile --pidfile ${GENTOASTER_PID} --user "${USER}" --stdout ${GENTOASTER_LOG} --exec /usr/bin/php --$
+ eend $?
}
+
stop() {
- echo "Stopping Gentoaster"
- killall -q -w -u $USER $GENTOASTER
- RETVAL=$?
+ ebegin "Stopping Gentoaster"
+ start-stop-daemon --stop --exec /usr/bin/php --pidfile ${GENTOASTER_PID}
+ eend $?
}
-
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- stop
- start
- ;;
- *)
- echo "Usage: gentoaster {start|stop|restart}"
- exit 1
- ;;
-esac
-exit $RETVAL
-