source: trunk/packages/invirt-console/debian/invirt-console-server.init @ 2118

Last change on this file since 2118 was 1813, checked in by broder, 16 years ago

Rename invirt-console-server source package to invirt-console

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