]> git.pld-linux.org Git - packages/Zope.git/blame - Zope.init
- BR: python-modules, rpm-pythonprov
[packages/Zope.git] / Zope.init
CommitLineData
8bc946c6 1#!/bin/sh
2e8ebf1a 2# zope
8bc946c6 3#
2e8ebf1a 4# chkconfig: 345 90 10
5# description: Starts and stops the Zope instances
6# processname: z2.py
7# config: /etc/sysconfig/zope
8bc946c6 8#
8bc946c6 9# probe: true
2e8ebf1a 10#
11
8bc946c6 12
13# Source function library.
14. /etc/rc.d/init.d/functions
15
92684bdc 16# Source networking configuration.
17. /etc/sysconfig/network
18
19# Check that networking is up.
20if is_yes "${NETWORKING}"; then
2e8ebf1a 21 if [ ! -f /var/lock/subsys/network ]; then
92684bdc 22 msg_network_down Zope
23 exit 1
24 fi
25else
26 exit 0
27fi
28
2e8ebf1a 29# Zope settings.
5c3330e7
JK
30INSTANCES="main"
31[ -f /etc/sysconfig/zope ] && . /etc/sysconfig/zope
8bc946c6 32
2e8ebf1a 33
2e8ebf1a 34start_instances()
35{
5c3330e7
JK
36 RETVAL=1
37 for INSTANCE_NAME in $INSTANCES
2e8ebf1a 38 do
5c3330e7
JK
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"
98e01857 43 continue
8bc946c6 44 fi
5c3330e7
JK
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
2e8ebf1a 51 fi
2e8ebf1a 52 done
5c3330e7 53 return $RETVAL
2e8ebf1a 54}
55
56stop_instances()
57{
5c3330e7
JK
58 RETVAL=1
59 for INSTANCE_NAME in $INSTANCES
2e8ebf1a 60 do
5c3330e7
JK
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"
98e01857 65 continue
2e8ebf1a 66 fi
98e01857 67
5c3330e7
JK
68 run_cmd "Stopping Zope instance $INSTANCE_NAME" "$INSTANCE_HOME"/bin/zopectl stop
69 RET=$?
70 if [ $RET -eq 0 ]; then
71 RETVAL=0
2e8ebf1a 72 fi
5c3330e7 73 rm -f /var/lock/subsys/"zope-$INSTANCE_NAME"
2e8ebf1a 74 done
5c3330e7 75 return $RETVAL
2e8ebf1a 76}
77
78stat_instances()
79{
5c3330e7 80 for INSTANCE_NAME in $INSTANCES
2e8ebf1a 81 do
5c3330e7 82 INSTANCE_HOME=/var/lib/zope/$INSTANCE_NAME
2e8ebf1a 83 PIDFILE=$INSTANCE_HOME/var/Z2.pid
5c3330e7 84 $INSTANCE_HOME/bin/zopectl status
2e8ebf1a 85 done
86}
87
88# See how we were called.
89case "$1" in
90 start)
5c3330e7
JK
91 msg_starting "Zope"
92 started
2e8ebf1a 93 start_instances
5c3330e7
JK
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
2e8ebf1a 103 ;;
104 stop)
f4e993a1 105 if [ -f /var/lock/subsys/zope ]; then
5c3330e7
JK
106 msg_stopping "Zope"
107 started
2e8ebf1a 108 stop_instances
5c3330e7
JK
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
2e8ebf1a 122 ;;
123 status)
5c3330e7 124 stat_instances
8bc946c6 125 ;;
ac4a49a8 126 restart|force-reload)
8bc946c6 127 $0 stop
128 $0 start
ac4a49a8 129 exit $?
8bc946c6 130 ;;
131 *)
ac4a49a8 132 msg_usage "$0 {start|stop|restart|force-reload|status}"
133 exit 3
8bc946c6 134 ;;
135esac
136
137exit $RETVAL
This page took 0.075898 seconds and 4 git commands to generate.