source: trunk/packages/invirt-remote/debian/invirt-remote-server.init @ 1988

Last change on this file since 1988 was 1822, checked in by broder, 16 years ago

Merge invirt-remote-host and invirt-remote-server into invirt-remote

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides:          invirt-remote-server
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
8# Short-Description: Invirt remctl configuration filesystem
9# Description:       
10### END INIT INFO
11
12# Author: Invirt project <invirt@mit.edu>
13
14PATH=/sbin:/usr/sbin:/bin:/usr/bin
15NAME=invirt-remote-server
16DESC="the Invirt remctl configuration filesystem"
17DAEMON=/usr/sbin/invirt-remconffs
18MOUNTPOINT="/etc/remctl/remconffs"
19DAEMON_ARGS="-f $MOUNTPOINT"
20PIDFILE=/var/run/$NAME.pid
21SCRIPTNAME=/etc/init.d/$NAME
22GEN_FILES=/etc/remctl/acl/web
23
24# Exit if the package is not installed
25[ -x "$DAEMON" ] || exit 0
26
27. /lib/init/gen-files.sh
28. /lib/init/std-init.sh
29
30#
31# Function that starts the daemon/service
32#
33do_start()
34{
35    # Return
36    #   0 if daemon has been started
37    #   1 if daemon was already running
38    #   2 if daemon could not be started
39   
40    # Try to make sure fuse is setup
41    [ -e /dev/fuse ] || modprobe fuse || return 2
42   
43    if cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
44        return 1
45    fi
46   
47    gen_files
48   
49    daemon -r -O daemon.info -E daemon.err -n $NAME -- $DAEMON $DAEMON_ARGS || return 2
50}
51
52#
53# Function that stops the daemon/service
54#
55do_stop()
56{
57    # Return
58    #   0 if daemon has been stopped
59    #   1 if daemon was already stopped
60    #   2 if daemon could not be stopped
61    #   other if a failure occurred
62   
63    if ! cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
64        return 1
65    fi
66   
67    daemon --stop -n $NAME
68    RETVAL="$?"
69    [ "$RETVAL" = 2 ] && return 2
70    # Many daemons don't delete their pidfiles when they exit.
71    rm -f $PIDFILE
72}
73
74do_reload()
75{
76    gen_files
77}
78
79std_init "$1"
Note: See TracBrowser for help on using the repository browser.