File: omnievents.omniorb-eventservice.init

package info (click to toggle)
omnievents 1%3A2.6.2-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,032 kB
  • sloc: cpp: 7,676; python: 3,138; sh: 2,648; xml: 2,057; java: 1,409; javascript: 551; makefile: 317; ansic: 9
file content (117 lines) | stat: -rw-r--r-- 3,107 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#! /bin/sh

#                            Package   : omniEvents
# omniorb-eventservice       Created   : 2004/07/11
#                            Author    : Alex Tingle
#   This file is part of the omniEvents application, most of which is licensed
#   under the Lesser GPL. This file ONLY is hereby released into the public
#   domain by Alex Tingle (2004/07/11).

#
# This SysV init script is LSB 1.3 compliant.
# It should work fine on any SysV system.
#

### BEGIN INIT INFO
# Provides: omniorb-eventservice
# Required-Start: $network $remote_fs $syslog
# Required-Stop:  $network $remote_fs $syslog
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Short-Description: CORBA event service
# Description: CORBA event service. http://www.omnievents.org/
### END INIT INFO

# ---------------------- the real stuff starts here----------------------------

# You might want to tweak the location of the configuration file:
CONFIGFILE=/etc/default/omniorb-eventservice

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/omniEvents
NAME=omniEvents
DESC="CORBA event service"

test -f $DAEMON || exit 5

. /lib/lsb/init-functions

#
# Default parameters. Don't change these here. Change them by setting them in
# file $CONFIGFILE
test -z "$OMNIEVENTS_LOGDIR"  && OMNIEVENTS_LOGDIR=/var/lib/omniEvents
test -z "$OMNIEVENTS_PORT"    && OMNIEVENTS_PORT=11169
OMNIEVENTS_PIDFILE=/var/run/$NAME.pid

# Load default preferences
test -f $CONFIGFILE && . $CONFIGFILE

# Calculate OPT_ALTERNATE & OPT_NS_NAME
test -n "$OMNIEVENTS_ALTERNATE" && OPT_ALTERNATE="-a $OMNIEVENTS_ALTERNATE"
test -n "$OMNIEVENTS_NS_NAME"   && OPT_NS_NAME="-N $OMNIEVENTS_NS_NAME"

startOE() {
  test -d $OMNIEVENTS_LOGDIR || mkdir -p $OMNIEVENTS_LOGDIR
  printf "Starting $DESC on port $OMNIEVENTS_PORT: "
  $DAEMON $OMNIEVENTS_OPTIONS -P $OMNIEVENTS_PIDFILE -l $OMNIEVENTS_LOGDIR \
    -p $OMNIEVENTS_PORT $OPT_ALTERNATE $OPT_NS_NAME
  echo "$NAME."
}

# If omniEvents is running, then send it SIGTERM and wait for
# up to 6 seconds for it to delete its PID file.
stopOE() {
  if [ -f $OMNIEVENTS_PIDFILE ] ; then
    printf "Stopping $DESC: "
    kill `cat $OMNIEVENTS_PIDFILE` || rm -f $OMNIEVENTS_PIDFILE 2>/dev/null
    t=0
    while test -f $OMNIEVENTS_PIDFILE -a $t -lt 6 ; do
      sleep 1
      t=`expr $t + 1`
    done
    echo "$NAME."
  fi
}

case "$1" in
  start)
        startOE
        ;;
  stop)
        stopOE
        ;;
  restart)
        stopOE
        startOE
        ;;
  status)
        if [ -f $OMNIEVENTS_PIDFILE ] ; then
          PID=`cat $OMNIEVENTS_PIDFILE`
          kill -0 $PID 2>/dev/null
          if [ "$?" = "0" ] ; then
            echo "$NAME running. PID=$PID"
          else
            echo "$NAME dead. PID=$PID"
            exit 1
          fi
        else
          echo "$NAME stopped."
          exit 3
        fi
        ;;
  force-reload)
        stopOE
        startOE
        ;;
  reload)
        echo "Not implemented."
        exit 3
        ;;
  *)
        N=/etc/init.d/omniorb-eventservice
        echo "Usage: $N {start|stop|restart|status}" >&2
        exit 1
        ;;
esac

exit 0