]> git.pld-linux.org Git - packages/dgee.git/blame - dgee.init
- updated for python 2.4
[packages/dgee.git] / dgee.init
CommitLineData
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
19GWCONFIG=/etc/dgeeconf.bin
20SRC_CONFIG=/etc/dgeeconf.xml
21
22# Get service config - may override defaults
23[ -f /etc/sysconfig/dgee ] && . /etc/sysconfig/dgee
a5a2056f 24export GWCONFIG
aaefea53 25
17bc7edf 26goldwater_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 34goldwater_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
44goldwater_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.
56if is_yes "${NETWORKING}"; then
11435672 57 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
aaefea53 58 # nls "ERROR: Networking is down. %s can't be run." dgee
59 msg_network_down dgee
60 exit 1
61 fi
62else
63 exit 0
64fi
65
11435672 66RETVAL=0
aaefea53 67# See how we were called.
68case "$1" in
69 start)
70 # Check if the service is already running?
71 if [ ! -f /var/lock/subsys/dgee ]; then
72 # show "Starting %s service" dgee
73 msg_starting dgee
74 busy
17bc7edf 75 goldwater_start
76 if [ $? = "0" ]; then
11435672 77 log_success "dgee startup"
78 goldwater_boot
79 if [ $? = "0" ]; then
80 log_success "dgeews startup"
81 ok
82 touch /var/lock/subsys/dgee
83 else
84 log_failed "dgeews startup"
85 goldwater_stop
86 if [ $? != "0" ]; then
87 log_failed "dgee shutdown"
88 fi
89 fail
90 exit 1
aaefea53 91 fi
11435672 92 else
aaefea53 93 fail
11435672 94 log_failed "dgee startup"
aaefea53 95 exit 1
aaefea53 96 fi
97 else
98 # show "%s service is already running." dgee
99 msg_already_running dgee
100 fi
101 ;;
102 stop)
103 if [ -f /var/lock/subsys/dgee ]; then
104 # Stop daemons.
105 # show "Stopping %s service" dgee
a5a2056f 106 msg_stopping dgee
aaefea53 107 busy
17bc7edf 108 goldwater_stop
109 if [ $? = "0" ]; then
11435672 110 log_success "dgee shutdown"
111 ok
112 rm -f /var/lock/subsys/dgee
aaefea53 113 else
11435672 114 log_failed "dgee shutdown"
115 fail
116 rm -f /var/lock/subsys/dgee
aaefea53 117 fi
118 else
119 # show "%s service is not running." dgee
120 msg_not_running dgee
121 fi
122 ;;
11435672 123 restart|force-reload)
aaefea53 124 $0 stop
125 $0 start
126 exit $?
127 ;;
11435672 128 reload)
aaefea53 129 if [ -f /var/lock/subsys/dgee ]; then
aaefea53 130 goldwater --prompt='dotGNU DGEE' cycle
131 RETVAL=$?
132 else
133 # show "%s service is not running." dgee
134 msg_not_running dgee >&2
135 RETVAL=7
136 fi
137 ;;
aaefea53 138 status)
139 status dgee
140 RETVAL=$?
141 ;;
142 compilecfg)
143 if [ -n $2 ]; then
11435672 144 SRC_CONFIG=$2
aaefea53 145 fi
146 /usr/bin/gwmkcfg $SRC_CONFIG
147 RETVAL=$?
148 ;;
149 *)
150 # show "Usage: %s {start|stop|restart|reload|force-reload|status}"
151 msg_usage "$0 \
152 {start|stop|restart|reload-ws|force-reload|status|compilecfg}"
153 exit 3
154esac
155
156exit $RETVAL
157
158# This must be last line !
159# vi:syntax=sh:tw=78:ts=8:sw=4
This page took 0.082997 seconds and 4 git commands to generate.