source: trunk/packages/invirt-vnc-server/debian/invirt-vnc-server.init @ 1399

Last change on this file since 1399 was 1399, checked in by broder, 15 years ago

Cleanup invirt-vnc-server's init script to use /lib/init/std-init.sh

File size: 1.4 KB
Line 
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides:          invirt-vnc-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 VNC 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
17PACKAGE=invirt-vnc-server
18DESC="The Invirt VNC Proxy Server"
19DAEMON=/usr/sbin/invirt-vnc-server
20DAEMON_ARGS=""
21PIDFILE=/var/run/$NAME.pid
22SCRIPTNAME=/etc/init.d/$NAME
23
24# Exit if the package is not installed
25[ -x "$DAEMON" ] || exit 0
26
27. /lib/init/std-init.sh
28
29#
30# Function that starts the daemon/service
31#
32do_start()
33{
34        # Return
35        #   0 if daemon has been started
36        #   1 if daemon was already running
37        #   2 if daemon could not be started
38        daemon --running -n $NAME && return 1
39        daemon -r -U -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2
40}
41
42#
43# Function that stops the daemon/service
44#
45do_stop()
46{
47        # Return
48        #   0 if daemon has been stopped
49        #   1 if daemon was already stopped
50        #   2 if daemon could not be stopped
51        #   other if a failure occurred
52        daemon --stop -n $NAME
53        RETVAL="$?"
54        [ "$RETVAL" = 2 ] && return 2
55        # Many daemons don't delete their pidfiles when they exit.
56        rm -f $PIDFILE
57        return "$RETVAL"
58}
59
60std_init "$1"
Note: See TracBrowser for help on using the repository browser.