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

Last change on this file since 2826 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
RevLine 
[843]1#!/bin/bash
[335]2### BEGIN INIT INFO
[1200]3# Provides:          invirt-console-server
[335]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
[1200]8# Short-Description: Invirt console proxy server
[335]9# Description:       
10### END INIT INFO
11
[1222]12# Author: Invirt project <invirt@mit.edu>
[335]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
[1200]18DESC="the Invirt console server"
19NAME=invirt-console-server
20DAEMON=/usr/bin/invirt-consolefs
[1741]21MOUNTPOINT="/consolefs"
22DAEMON_ARGS="-f $MOUNTPOINT"
[335]23PIDFILE=/var/run/$NAME.pid
24SCRIPTNAME=/etc/init.d/$NAME
[1747]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)
[335]29
30# Exit if the package is not installed
31[ -x "$DAEMON" ] || exit 0
32
[1747]33. /lib/init/gen-files.sh
[1742]34. /lib/init/std-init.sh
[335]35
36#
37# Function that starts the daemon/service
38#
39do_start()
40{
[1740]41    # Return
42    #   0 if daemon has been started
43    #   1 if daemon was already running
44    #   2 if daemon could not be started
[1741]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   
[1747]53    gen_files
[1741]54   
55    daemon -r -O daemon.info -E daemon.err -n $NAME -- $DAEMON $DAEMON_ARGS || return 2
[335]56}
57
58#
59# Function that stops the daemon/service
60#
61do_stop()
62{
[1740]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
[1741]68   
69    if ! cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
70        return 1
71    fi
72   
[1740]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
[335]78}
79
[699]80do_reload()
81{
[1752]82    gen_files
[1740]83    invoke-rc.d conserver-server reload
[699]84}
85
[1742]86std_init "$1"
Note: See TracBrowser for help on using the repository browser.