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

Last change on this file since 2763 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
RevLine 
[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
14PATH=/sbin:/usr/sbin:/bin:/usr/bin
[1534]15NAME=invirt-remote-server
[1176]16DESC="the Invirt remctl configuration filesystem"
17DAEMON=/usr/sbin/invirt-remconffs
[1743]18MOUNTPOINT="/etc/remctl/remconffs"
19DAEMON_ARGS="-f $MOUNTPOINT"
[525]20PIDFILE=/var/run/$NAME.pid
21SCRIPTNAME=/etc/init.d/$NAME
[1534]22GEN_FILES=/etc/remctl/acl/web
[525]23
24# Exit if the package is not installed
25[ -x "$DAEMON" ] || exit 0
26
[1534]27. /lib/init/gen-files.sh
28. /lib/init/std-init.sh
[525]29
[1743]30#
31# Function that starts the daemon/service
32#
[525]33do_start()
34{
[1740]35    # Return
36    #   0 if daemon has been started
37    #   1 if daemon was already running
38    #   2 if daemon could not be started
[1743]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   
[1746]47    gen_files
[1743]48   
49    daemon -r -O daemon.info -E daemon.err -n $NAME -- $DAEMON $DAEMON_ARGS || return 2
[525]50}
51
[1743]52#
53# Function that stops the daemon/service
54#
[525]55do_stop()
56{
[1740]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
[1743]62   
63    if ! cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
64        return 1
65    fi
66   
[1740]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
[525]72}
73
[1743]74do_reload()
75{
[1752]76    gen_files
[1743]77}
78
[1534]79std_init "$1"
Note: See TracBrowser for help on using the repository browser.