diff options
Diffstat (limited to 'devel/p4web/files/perforce.sh.in')
-rw-r--r-- | devel/p4web/files/perforce.sh.in | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/devel/p4web/files/perforce.sh.in b/devel/p4web/files/perforce.sh.in index 33398a7a8691..38cdb146e00e 100644 --- a/devel/p4web/files/perforce.sh.in +++ b/devel/p4web/files/perforce.sh.in @@ -1,14 +1,38 @@ #!/bin/sh +# +# $FreeBSD$ + +p4d=@PREFIX@/sbin/p4d +p4ftpd=@PREFIX@/sbin/p4ftpd + case $1 in - start) - [ -f @PREFIX@/etc/perforce ] && . @PREFIX@/etc/perforce - if [ x$PERFORCE_START = xyes ]; then - echo -n ' perforce' - p4d -r $PERFORCE_ROOT $PERFORCE_OPTIONS +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 + ;; +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 + ;; +restart) + $0 stop + sleep 1 + $0 start ;; - stop) - killall p4d && echo -n ' perforce' +*) + echo "usage: $0 {start|stop|restart}" + exit 64 ;; - *) ;; esac |