summaryrefslogtreecommitdiffstats
path: root/www/zope213/files/zope213.in
blob: 5a4680776c062475566c31085bc7479730b71ac4 (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
#!/bin/sh
#
# Startup script for Zope server.
#
# $FreeBSD$
#
# PROVIDE: zope213
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Define these zope213_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
#
# zope213_enable : bool
# Enable Zope ("YES") or not ("NO", the default).
#
# zope213_instances : list
# List of dirs with Zope's instances ("" by default).
#

. /etc/rc.subr

name="zope213"
rcvar=`set_rcvar`

load_rc_config $name

: ${zope213_enable:="NO"}
: ${zope213_instances:="%%ZOPEINSTANCEDIR%%"}

zope213_check_instances () {
	cmd="$1"
	shift

	if [ -n "$*" ]; then
		zope213_instances="$@"
	elif [ -z "$zope213_instances" ]; then
		err 1 "No value for zope213_instances, so nothing to do"
	fi
}

zope213ctl () {
	local instance

	for instance in $zope213_instances; do
		if [ -d ${instance} ]; then
			echo -n " Zope instance ${instance} -> "
			${instance}/bin/zopectl "$1"
		fi
	done
}

zope213_start () {
	zope213_check_instances
	echo -n 'Starting Zope 2.13:'
	zope213ctl "start"
	echo '.'
}

zope213_stop () {
	zope213_check_instances
	echo -n 'Stopping Zope 2.13:'
	zope213ctl "stop"
	echo '.'
}

zope213_restart () {
	zope213_check_instances
	echo -n 'Restarting Zope 2.13:'
	zope213ctl "restart"
	echo '.'
}

start_cmd="${name}_start"
stop_cmd="${name}_stop"
restart_cmd="${name}_restart"

cmd="$1"
shift
if [ -n  "$*" ]; then
	zope213_instances="$@"
fi

run_rc_command "${cmd}"
OpenPOWER on IntegriCloud