]>
Commit | Line | Data |
---|---|---|
aaefea53 | 1 | #!/bin/sh |
2 | # | |
3 | # dgee dgee short service description | |
4 | # | |
91a9de57 | 5 | #Start right before apache: |
6 | # chkconfig: 345 84 16 | |
aaefea53 | 7 | # |
8 | # description: dgee long service description | |
9 | # | |
10 | # $Id$ | |
11 | ||
aaefea53 | 12 | # Source function library |
13 | . /etc/rc.d/init.d/functions | |
14 | ||
15 | # Get network config | |
16 | . /etc/sysconfig/network | |
17 | ||
aaefea53 | 18 | # Set defaults |
19 | GWCONFIG=/etc/dgeeconf.bin | |
20 | SRC_CONFIG=/etc/dgeeconf.xml | |
21 | ||
22 | # Get service config - may override defaults | |
23 | [ -f /etc/sysconfig/dgee ] && . /etc/sysconfig/dgee | |
a5a2056f | 24 | export GWCONFIG |
aaefea53 | 25 | |
17bc7edf | 26 | goldwater_start () { |
11435672 | 27 | stat=`goldwater --prompt='dotGNU DGEE' start | grep -e"Goldwater Started."` |
28 | if [ "$stat" = "Goldwater Started." ]; then | |
29 | return 0 | |
30 | fi | |
31 | return 1 | |
17bc7edf | 32 | } |
11435672 | 33 | |
17bc7edf | 34 | goldwater_stop () { |
11435672 | 35 | goldwater --prompt='dotGNU DGEE' stop | \ |
36 | grep -e "++ Halting" | \ | |
37 | awk 'BEGIN{err=0}/$12~"Halted"/{next}{err++}END{exit err}' | |
38 | if [ $? = "0" ]; then | |
39 | return 0; | |
40 | fi | |
17bc7edf | 41 | return 1; |
17bc7edf | 42 | } |
43 | ||
44 | goldwater_boot () { | |
11435672 | 45 | goldwater --prompt='dotGNU DGEE' boot | \ |
46 | grep -e "++ Booting" | \ | |
47 | awk 'BEGIN{err=0}/$12~"Booted"/{next}{err++}END{exit err}' | |
48 | ||
49 | if [ $? = "0" ]; then | |
50 | return 0 | |
51 | fi | |
17bc7edf | 52 | return 1 |
17bc7edf | 53 | } |
aaefea53 | 54 | |
55 | # Check that networking is up. | |
56 | if is_yes "${NETWORKING}"; then | |
11435672 | 57 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
aaefea53 | 58 | msg_network_down dgee |
59 | exit 1 | |
60 | fi | |
61 | else | |
62 | exit 0 | |
63 | fi | |
64 | ||
11435672 | 65 | RETVAL=0 |
aaefea53 | 66 | # See how we were called. |
67 | case "$1" in | |
68 | start) | |
69 | # Check if the service is already running? | |
70 | if [ ! -f /var/lock/subsys/dgee ]; then | |
aaefea53 | 71 | msg_starting dgee |
72 | busy | |
17bc7edf | 73 | goldwater_start |
74 | if [ $? = "0" ]; then | |
11435672 | 75 | log_success "dgee startup" |
76 | goldwater_boot | |
77 | if [ $? = "0" ]; then | |
78 | log_success "dgeews startup" | |
79 | ok | |
80 | touch /var/lock/subsys/dgee | |
81 | else | |
82 | log_failed "dgeews startup" | |
83 | goldwater_stop | |
84 | if [ $? != "0" ]; then | |
85 | log_failed "dgee shutdown" | |
86 | fi | |
87 | fail | |
88 | exit 1 | |
aaefea53 | 89 | fi |
11435672 | 90 | else |
aaefea53 | 91 | fail |
11435672 | 92 | log_failed "dgee startup" |
aaefea53 | 93 | exit 1 |
aaefea53 | 94 | fi |
95 | else | |
aaefea53 | 96 | msg_already_running dgee |
97 | fi | |
98 | ;; | |
99 | stop) | |
100 | if [ -f /var/lock/subsys/dgee ]; then | |
101 | # Stop daemons. | |
a5a2056f | 102 | msg_stopping dgee |
aaefea53 | 103 | busy |
17bc7edf | 104 | goldwater_stop |
105 | if [ $? = "0" ]; then | |
11435672 | 106 | log_success "dgee shutdown" |
107 | ok | |
108 | rm -f /var/lock/subsys/dgee | |
aaefea53 | 109 | else |
11435672 | 110 | log_failed "dgee shutdown" |
111 | fail | |
112 | rm -f /var/lock/subsys/dgee | |
e3a827ad | 113 | fi |
aaefea53 | 114 | else |
aaefea53 | 115 | msg_not_running dgee |
116 | fi | |
117 | ;; | |
11435672 | 118 | restart|force-reload) |
aaefea53 | 119 | $0 stop |
120 | $0 start | |
121 | exit $? | |
122 | ;; | |
11435672 | 123 | reload) |
aaefea53 | 124 | if [ -f /var/lock/subsys/dgee ]; then |
aaefea53 | 125 | goldwater --prompt='dotGNU DGEE' cycle |
126 | RETVAL=$? | |
127 | else | |
aaefea53 | 128 | msg_not_running dgee >&2 |
129 | RETVAL=7 | |
130 | fi | |
131 | ;; | |
aaefea53 | 132 | status) |
133 | status dgee | |
134 | RETVAL=$? | |
135 | ;; | |
136 | compilecfg) | |
137 | if [ -n $2 ]; then | |
11435672 | 138 | SRC_CONFIG=$2 |
aaefea53 | 139 | fi |
140 | /usr/bin/gwmkcfg $SRC_CONFIG | |
141 | RETVAL=$? | |
142 | ;; | |
143 | *) | |
aaefea53 | 144 | msg_usage "$0 \ |
145 | {start|stop|restart|reload-ws|force-reload|status|compilecfg}" | |
146 | exit 3 | |
147 | esac | |
148 | ||
149 | exit $RETVAL | |
150 | ||
151 | # This must be last line ! | |
152 | # vi:syntax=sh:tw=78:ts=8:sw=4 |