[525] | 1 | #! /bin/sh |
---|
| 2 | ### BEGIN INIT INFO |
---|
[1176] | 3 | # Provides: invirt-remote-server |
---|
[525] | 4 | # Required-Start: $local_fs $remote_fs |
---|
| 5 | # Required-Stop: $local_fs $remote_fs |
---|
| 6 | # Default-Start: 2 3 4 5 |
---|
| 7 | # Default-Stop: 0 1 6 |
---|
[1176] | 8 | # Short-Description: Invirt remctl configuration filesystem |
---|
[525] | 9 | # Description: |
---|
| 10 | ### END INIT INFO |
---|
| 11 | |
---|
[1224] | 12 | # Author: Invirt project <invirt@mit.edu> |
---|
[525] | 13 | |
---|
| 14 | PATH=/sbin:/usr/sbin:/bin:/usr/bin |
---|
[1534] | 15 | NAME=invirt-remote-server |
---|
[1176] | 16 | DESC="the Invirt remctl configuration filesystem" |
---|
| 17 | DAEMON=/usr/sbin/invirt-remconffs |
---|
[525] | 18 | DAEMON_ARGS="/etc/remctl/remconffs" |
---|
| 19 | PIDFILE=/var/run/$NAME.pid |
---|
| 20 | SCRIPTNAME=/etc/init.d/$NAME |
---|
[1534] | 21 | GEN_FILES=/etc/remctl/acl/web |
---|
[525] | 22 | |
---|
| 23 | # Exit if the package is not installed |
---|
| 24 | [ -x "$DAEMON" ] || exit 0 |
---|
| 25 | |
---|
[1534] | 26 | . /lib/init/gen-files.sh |
---|
| 27 | . /lib/init/std-init.sh |
---|
[525] | 28 | |
---|
| 29 | do_start() |
---|
| 30 | { |
---|
[1740] | 31 | # Return |
---|
| 32 | # 0 if daemon has been started |
---|
| 33 | # 1 if daemon was already running |
---|
| 34 | # 2 if daemon could not be started |
---|
| 35 | gen_files |
---|
| 36 | modprobe fuse |
---|
| 37 | daemon --running -n $NAME && return 1 |
---|
| 38 | daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2 |
---|
[525] | 39 | } |
---|
| 40 | |
---|
| 41 | do_stop() |
---|
| 42 | { |
---|
[1740] | 43 | # Return |
---|
| 44 | # 0 if daemon has been stopped |
---|
| 45 | # 1 if daemon was already stopped |
---|
| 46 | # 2 if daemon could not be stopped |
---|
| 47 | # other if a failure occurred |
---|
| 48 | daemon --stop -n $NAME |
---|
| 49 | RETVAL="$?" |
---|
| 50 | [ "$RETVAL" = 2 ] && return 2 |
---|
| 51 | # Many daemons don't delete their pidfiles when they exit. |
---|
| 52 | rm -f $PIDFILE |
---|
| 53 | umount "$DAEMON_ARGS" |
---|
| 54 | return "$RETVAL" |
---|
[525] | 55 | } |
---|
| 56 | |
---|
[1534] | 57 | std_init "$1" |
---|