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
8 # Short-Description: Invirt console proxy server
12 # Author: Invirt project <invirt@mit.edu>
16 # PATH should only include /usr/* if it runs after the mountnfs.sh script
17 PATH=/sbin:/usr/sbin:/bin:/usr/bin
18 DESC="the Invirt console server"
19 NAME=invirt-console-server
20 DAEMON=/usr/bin/invirt-consolefs
21 MOUNTPOINT="/consolefs"
22 DAEMON_ARGS="-f $MOUNTPOINT"
23 PIDFILE=/var/run/$NAME.pid
24 SCRIPTNAME=/etc/init.d/$NAME
25 GEN_FILES=(/etc/conserver/invirt-hosts.cf
26 /etc/remctl/acl/invirt-console-server
30 # Exit if the package is not installed
31 [ -x "$DAEMON" ] || exit 0
33 . /lib/init/gen-files.sh
34 . /lib/init/std-init.sh
37 # Function that starts the daemon/service
42 # 0 if daemon has been started
43 # 1 if daemon was already running
44 # 2 if daemon could not be started
46 # Try to make sure fuse is setup
47 [ -e /dev/fuse ] || modprobe fuse || return 2
49 if cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
55 daemon -r -O daemon.info -E daemon.err -n $NAME -- $DAEMON $DAEMON_ARGS || return 2
59 # Function that stops the daemon/service
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
69 if ! cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
73 daemon --stop -n $NAME
75 [ "$RETVAL" = 2 ] && return 2
76 # Many daemons don't delete their pidfiles when they exit.
83 invoke-rc.d conserver-server reload