summaryrefslogtreecommitdiff
path: root/devel/p4p/files/perforce.sh.in
blob: 2ebc5809fa481ce239fb4de20505e4344a24bc12 (plain) (blame)
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
#!/bin/sh
#
# $FreeBSD$

p4d=@PREFIX@/sbin/p4d
p4ftpd=@PREFIX@/sbin/p4ftpd
p4p=@PREFIX@/sbin/p4p
p4web=@PREFIX@/sbin/p4web

case $1 in
start)
    [ -f @PREFIX@/etc/perforce.conf ] && . @PREFIX@/etc/perforce.conf
    if [ -x $p4d -a x$PERFORCE_START = xyes ]; then
	echo -n ' p4d'
	su -fm $PERFORCE_USER -c "$p4d -r $PERFORCE_ROOT $PERFORCE_OPTIONS"
    fi
    if [ -x $p4ftpd -a x$PERFORCE_FTPD_START = xyes ]; then
	echo -n ' p4ftpd'
	$p4ftpd $PERFORCE_FTPD_OPTIONS
    fi
    if [ -x $p4p -a x$PERFORCE_PROXY_START = xyes ]; then
        echo -n ' p4p'
        $p4p $PERFORCE_PROXY_OPTIONS
    fi
    if [ -x $p4web -a x$PERFORCE_WEB_START = xyes ]; then
        echo -n ' p4web'
        su -fm $PERFORCE_USER -c "$p4web $PERFORCE_WEB_OPTIONS &" >/dev/null 2>&1
    fi

    ;;
stop)
    [ -f @PREFIX@/etc/perforce.conf ] && . @PREFIX@/etc/perforce.conf
    if [ -x $p4ftpd ]; then
	killall -u 0 p4ftpd >/dev/null 2>&1 && echo -n ' p4ftpd'
    fi
    if [ -x $p4d ]; then
	killall -u $PERFORCE_USER p4d >/dev/null 2>&1 && echo -n ' p4d'
    fi
    if [ -x $p4p ]; then
        killall -u 0 p4p > /dev/null 2>&1 && echo -n ' p4p'
    fi
    if [ -x $p4web ]; then
        killall -u $PERFORCE_USER p4web > /dev/null 2>&1 && echo -n ' p4web'
    fi
    ;;
restart)
    $0 stop
    sleep 1
    $0 start
    ;;
checkpoint)
    [ -f @PREFIX@/etc/perforce.conf ] && .  @PREFIX@/etc/perforce.conf
    if [ -x $p4d -a x$PERFORCE_START = xyes ]; then
	su -fm $PERFORCE_USER -c "$p4d -r $PERFORCE_ROOT -jc"
    fi
    ;;
*)
    echo "usage: $0 {start|stop|restart|checkpoint}"
    exit 64
    ;;
esac