File: init

package info (click to toggle)
backuppc 4.4.0-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,752 kB
  • sloc: perl: 37,523; sh: 607; javascript: 176; makefile: 38; ansic: 6
file content (79 lines) | stat: -rw-r--r-- 2,200 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
### BEGIN INIT INFO
# Provides:          backuppc
# Required-Start:    $syslog $network $remote_fs
# Required-Stop:     $syslog $network $remote_fs
# Should-Start:      $local_fs autofs
# Should-Stop:       $local_fs autofs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Launch backuppc server
# Description:       Launch backuppc server, a high-performance,
#                    enterprise-grade system for backing up PCs.
### END INIT INFO

set -e

# Do not change the values below! Performance related settings can be
# changed in /etc/default/backuppc. See /usr/share/doc/backuppc/README.Debian.
BINDIR=/usr/share/backuppc/bin
DATADIR=/var/lib/backuppc
RUNDIR=/run/backuppc
USER=backuppc
GROUP=backuppc
NICE=0
IONICE=best-effort

test -f /etc/default/backuppc && . /etc/default/backuppc

#
NAME=backuppc
DAEMON=BackupPC

test -x $BINDIR/$DAEMON || exit 0
. /lib/lsb/init-functions
[ -r /etc/default/rcS ] && . /etc/default/rcS

if [ ! -d $RUNDIR ]; then
    mkdir -p $RUNDIR
    chown ${USER}:${GROUP} $RUNDIR
    chmod 0755 $RUNDIR
fi

case "$1" in
  start)
    log_begin_msg "Starting $NAME..."
    start-stop-daemon --start --pidfile $RUNDIR/BackupPC.pid \
			    --nicelevel $NICE --iosched $IONICE -c $USER --exec $BINDIR/$DAEMON -- -d
    log_end_msg $?
    ;;
  stop)
    log_begin_msg "Stopping $NAME..."
    start-stop-daemon --stop --pidfile $RUNDIR/BackupPC.pid -u $USER \
			    --oknodo --retry 30
    log_end_msg $?
      ;;
  restart)
    log_begin_msg "Restarting $NAME..."
    start-stop-daemon --stop --pidfile $RUNDIR/BackupPC.pid -u $USER \
			    --oknodo --retry 30
    start-stop-daemon --start --pidfile $RUNDIR/BackupPC.pid \
			    --nicelevel $NICE --iosched $IONICE -c $USER --exec $BINDIR/$DAEMON -- -d
    log_end_msg $?
    ;;
  reload|force-reload)
    log_begin_msg "Reloading $NAME configuration files..."
    start-stop-daemon --stop --pidfile $RUNDIR/BackupPC.pid -u $USER \
			    --signal 1
    log_end_msg $?
    ;;
  status)
    status_of_proc "$BINDIR/$DAEMON" "$NAME" && exit 0 || exit $?
    ;;
  *)
    log_success_msg "Usage: /etc/init.d/$NAME {start|stop|restart|reload|status}"
    exit 1
    ;;
esac

exit 0