summaryrefslogtreecommitdiff
path: root/www/zope3/files/zope3.sh
blob: f0529d4196ff9ca864cbd043852c55bab3d674b3 (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
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: zope3.sh,v 1.3 2006/05/06 22:38:28 wiz Exp $
#
# PROVIDE: zope3
# REQUIRE: DAEMON
# KEYWORD: shutdown

$_rc_subr_loaded . /etc/rc.subr

name="zope3"
rcvar=$name
extra_commands="status"
command="@PREFIX@/share/zope3/bin/zdctl.py"
start_cmd="zope3_start"
start_precmd="zope3_precmd"
stop_cmd="zope3_stop"
stop_precmd="zope3_precmd"
restart_cmd="zope3_restart"
restart_precmd="zope3_precmd"
status_cmd="zope3_status"
status_precmd="zope3_precmd"
zope3_instance_home="@VARBASE@/zope3"
required_dirs="${zope3_instance_home}"
command_args="--daemon --socket-name ${zope3_instance_home}/var/zdsock --program ${zope3_instance_home}/bin/runzope"

zope3_precmd() {
    for _dir in $required_dirs; do
    if test ! -d "${_dir}"; then
        err 1 "${_dir} is not a directory."
    fi
    done
    if test -z "${zope3_user}"; then
        zope3_user="@ZOPE3_USER@"
    fi
    command_args="${command_args} --user ${zope3_user}"
}

zope3_start() {
    echo -n "Starting Zope Application Server: "
    ${command} ${rc_flags} ${command_args} start
}

zope3_stop() {
    echo -n "Stopping Zope Application Server: "
    ${command} ${rc_flags} ${command_args} stop
}

zope3_restart() {
    echo -n "Restarting Zope Application Server: "
    ${command} ${rc_flags} ${command_args} restart
}

zope3_status() {
    ${command} ${rc_flags} ${command_args} status
}

load_rc_config $name
run_rc_command "$1"