summaryrefslogtreecommitdiff
blob: 039dc01d4c5cf0c88802f651f80661ade492342f (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
#!/sbin/runscript 
# Zope rc-script for Gentoo Linux
# Copyright 2002-2003 by Jason Shoemaker
# Distributed under the terms of the GNU General Public License, v2 or later.
# $Header: /var/cvsroot/gentoo-x86/net-zope/zope/files/2.7.1/zope.initd,v 1.1 2004/07/13 23:33:52 batlogg Exp $

PIDFILE=${INSTANCE_HOME}/var/Z2.pid

depend() 
{
    need net
}

zope_is_alive()
{
    [ -r "${PIDFILE}" ] || return 1
    PID=$(cat ${PIDFILE})
    [ -d "/proc/${PID}" ] || return 1
}

status()
{
    zope_is_alive && einfo "Zope is alive" && return 0
    ewarn "Zope is dead"
    return 1
}

start()
{
    ebegin "Starting zope"
    start-stop-daemon --start --quiet --exec ${INSTANCE_HOME}/bin/runzope --pidfile ${PIDFILE} > ${EVENT_LOG_FILE} 2>&1 &
    eend $? "Failed to start zope"
}


stop()
{
    local RESULT=0
    ebegin "Stopping zope"
    if zope_is_alive ; then
    	start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
	RESULT=${?}
    else
        ewarn "Zope was already dead."
    fi
    eend ${RESULT} "Failed to stop zope"
}