]> git.pld-linux.org Git - packages/Zope.git/blame_incremental - Zope.init
- Patch4 was outdated
[packages/Zope.git] / Zope.init
... / ...
CommitLineData
1#!/bin/sh
2# zope
3#
4# chkconfig: 345 90 10
5# description: Starts and stops the Zope instances
6# processname: z2.py
7# config: /etc/sysconfig/zope
8#
9# probe: true
10#
11
12
13# Source function library.
14. /etc/rc.d/init.d/functions
15
16# Source networking configuration.
17. /etc/sysconfig/network
18
19# Check that networking is up.
20if is_yes "${NETWORKING}"; then
21 if [ ! -f /var/lock/subsys/network ]; then
22 msg_network_down Zope
23 exit 1
24 fi
25else
26 exit 0
27fi
28
29# Zope settings.
30INSTANCES="main"
31[ -f /etc/sysconfig/zope ] && . /etc/sysconfig/zope
32
33
34start_instances()
35{
36 RETVAL=1
37 for INSTANCE_NAME in $INSTANCES
38 do
39 INSTANCE_HOME="/var/lib/zope/$INSTANCE_NAME"
40
41 if [ -f /var/lock/subsys/"zope-$INSTANCE_NAME" ]; then
42 msg_already_running "Zope instance $INSTANCE_NAME"
43 continue
44 fi
45
46 run_cmd "Starting Zope instance $INSTANCE_NAME" "$INSTANCE_HOME"/bin/zopectl start
47 RET=$?
48 if [ $RET -eq 0 ]; then
49 touch /var/lock/subsys/"zope-$INSTANCE_NAME"
50 RETVAL=0
51 fi
52 done
53 return $RETVAL
54}
55
56stop_instances()
57{
58 RETVAL=1
59 for INSTANCE_NAME in $INSTANCES
60 do
61 INSTANCE_HOME="/var/lib/zope/$INSTANCE_NAME"
62
63 if [ ! -f /var/lock/subsys/"zope-$INSTANCE_NAME" ]; then
64 msg_not_running "Zope instance $INSTANCE_NAME"
65 continue
66 fi
67
68 run_cmd "Stopping Zope instance $INSTANCE_NAME" "$INSTANCE_HOME"/bin/zopectl stop
69 RET=$?
70 if [ $RET -eq 0 ]; then
71 RETVAL=0
72 fi
73 rm -f /var/lock/subsys/"zope-$INSTANCE_NAME"
74 done
75 return $RETVAL
76}
77
78stat_instances()
79{
80 for INSTANCE_NAME in $INSTANCES
81 do
82 INSTANCE_HOME=/var/lib/zope/$INSTANCE_NAME
83 PIDFILE=$INSTANCE_HOME/var/Z2.pid
84 $INSTANCE_HOME/bin/zopectl status
85 done
86}
87
88# See how we were called.
89case "$1" in
90 start)
91 msg_starting "Zope"
92 started
93 start_instances
94 RETVAL=$?
95 if [ "$RETVAL" = 0 ] ; then
96 msg_starting "Zope"
97 ok
98 touch /var/lock/subsys/zope
99 else
100 msg_starting "Zope"
101 fail
102 fi
103 ;;
104 stop)
105 if [ -f /var/lock/subsys/zope ]; then
106 msg_stopping "Zope"
107 started
108 stop_instances
109 RETVAL=$?
110 if [ "$RETVAL" = 0 ] ; then
111 msg_stopping "Zope"
112 ok
113 else
114 msg_stopping "Zope"
115 fail
116 fi
117 rm -f /var/lock/subsys/zope >/dev/null 2>&1
118 else
119 msg_not_running "Zope"
120 exit 1
121 fi
122 ;;
123 status)
124 stat_instances
125 ;;
126 restart|force-reload)
127 $0 stop
128 $0 start
129 exit $?
130 ;;
131 *)
132 msg_usage "$0 {start|stop|restart|force-reload|status}"
133 exit 3
134 ;;
135esac
136
137exit $RETVAL
This page took 0.066531 seconds and 4 git commands to generate.