summaryrefslogtreecommitdiffstats
path: root/icegridnode.init
blob: f400d117699aa6cde0649bd554af16f437dd9a23 (plain)
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
#!/bin/bash
#
# Copyright (c) 2007-2010 ZeroC, Inc. All rights reserved.
#
# icegridnode   This shell script takes care of starting and 
#               stopping the icegridnode daemon.
#
# chkconfig: - 61 75
# description: The IceGrid node daemon. \
# IceGrid is the server deployment and monitoring for the Internet \
# Communications Engine (Ice). An IceGrid domain consists of one master \
# registry, zero or more slave registries, and zero or more IceGrid nodes.

#
# Source function library.
#
. /etc/init.d/functions

#
# The IceGrid node user; root is allowed, but not necessary, therefore
# it is recommended to use a non-root account.
#
user=iceuser

#
# Ask for a password at startup?
#
prompt=no

#
# The IceGrid node configuration file
#
nodeconf="/etc/icegridnode.conf"

prog="/usr/bin/icegridnode"

progbase=${prog##*/}
pidfile=/var/run/$progbase.pid

options="--daemon --pidfile $pidfile --Ice.Config=$nodeconf"

RETVAL=0

start() {
        if [ "${prompt:-}" = "yes" ]
        then
           echo $"Starting $progbase: "
           INITLOG_ARGS=              # clears -q
        else
           echo -n $"Starting $progbase: "
        fi

        daemonoptions="--pidfile $pidfile"
        if [ "$user" != "root" ]
        then
            daemonoptions="$daemonoptions --user $user"
    
            if [ ! -e $pidfile ]
            then
                touch $pidfile
            fi
            chown $user $pidfile
        fi           

        daemon $daemonoptions $prog $options
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$progbase
        return $RETVAL
}

stop() {
        echo -n $"Shutting down $progbase: "
        killproc -p $pidfile $prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$progbase
        return $RETVAL
}


# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status $progbase
        RETVAL=$?
        ;;
  restart|reload)
        stop
        start
        RETVAL=$?
        ;;
  condrestart)
        if [ -f /var/lock/subsys/$progbase ]; then
            stop
            start
            RETVAL=$?
        fi
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        exit 1
esac

exit $RETVAL