freebsd-ports/sysutils/blimitd/files/blimitd.sh
Christian Weisgerber 13a7d7db16 The startup script supportes an argument of status which is just a quick way to
see if the daemon is running. The case when the daemon wasn't apparently
running was missing a "fi". While we're here, fancify the grep a little and
fix the fact that it shows you the script is running as well as the daemon.

Reported by:	Jonathan Towne <jontow@twcny.rr.com>

PR:		41252
Submitted by:	Andrew Stevenson <andrew@ugh.net.au>
2002-08-02 10:55:12 +00:00

36 lines
677 B
Bash

#!/bin/sh
# $FreeBSD$
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
echo "$0: Cannot determine the PREFIX" >&2
exit 1
fi
case $1 in
start)
[ -x ${PREFIX}/sbin/blimitd ] &&
echo -n ' blimitd' &&
${PREFIX}/sbin/blimitd
;;
stop)
[ -f /var/run/blimitd.pid ] &&
echo -n ' blimitd' &&
kill `cat /var/run/blimitd.pid`
;;
status)
if [ -f /var/run/blimitd.pid ]; then
ps -uxwwp `cat /var/run/blimitd.pid`
else
echo 'blimitd may not be running...possible processes below...'
echo
ps -auxww | egrep -e '^USER|blimitd' | egrep -v "($0|grep)"
fi
;;
*)
echo "usage: `basename $0` {start|stop|status}" >&2
exit 64
;;
esac
exit 0