aboutsummaryrefslogtreecommitdiff
path: root/src/backuppc/backuppc.rc
diff options
context:
space:
mode:
Diffstat (limited to 'src/backuppc/backuppc.rc')
-rwxr-xr-xsrc/backuppc/backuppc.rc54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/backuppc/backuppc.rc b/src/backuppc/backuppc.rc
new file mode 100755
index 0000000..f3b4a02
--- /dev/null
+++ b/src/backuppc/backuppc.rc
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/share/backuppc/bin/BackupPC
+
+PIDFILE=${PIDFILE:-/var/log/backuppc/BackupPC.pid}
+DAEMON_OPTS=${DAEMON_OPTS:--d}
+DAEMON_USER=${DAEMON_USER:-backuppc}
+DAEMON_GROUP=${DAEMON_GROUP:-nobody}
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ if start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
+ -c $DAEMON_USER -g $DAEMON_GROUP --startas $DAEMON -- \
+ $DAEMON_OPTS; then
+ stat_done
+ add_daemon ${0##*/}
+ exit 0
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ if start-stop-daemon --stop --quiet --pidfile "$PIDFILE"; then
+ rm_daemon ${0##*/}
+ rm "$PIDFILE"
+ stat_done
+ exit 0
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ reload)
+ stat_busy "Reloading ${0##*/} dameon"
+ start-stop-daemon --stop --signal HUP --quiet --pidfile "$PIDFILE" \
+ && { stat_done; exit 0; } || { stat_fail; exit 1; }
+ ;;
+ restart)
+ $0 stop && sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+# vim:set ts=2 sw=2 ft=sh et: