ports/90078: addition of a gnump3d.sh rc script
Josh Carroll
floyd at pflog.net
Wed Dec 7 17:40:24 UTC 2005
>Number: 90078
>Category: ports
>Synopsis: addition of a gnump3d.sh rc script
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Wed Dec 07 17:40:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Josh Carroll
>Release: FreeBSD 6.0-RELEASE i386
>Organization:
n/a
>Environment:
System: FreeBSD pflog.net 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Mon Dec 5 22:43:02 PST 2005 root at pflog.net:/usr/obj/usr/src/sys/DEBLIN i386
>Description:
Currently the gnump3d port lacks a FreeBSD rc script. This would add a gnump3d.sh
to the port. Either as an example or copied as part of the port. I'll leave that
up to the maintainer. Proposed gnump3d.sh rc script attached.
>How-To-Repeat:
n/a
>Fix:
See attached gnump3d.sh script (based on apcupsd.sh with forcestart/forcestop added)
--- gnump3d.sh begins here ---
#!/bin/sh
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
echo "$0: Cannot determine the PREFIX" >&2
exit 1
fi
# If there is a global system configuration file, suck it in.
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
gnump3d_enable=${gnump3d_enable:-YES}
gnump3d_program=${gnump3d_program:-${PREFIX}/bin/gnump3d}
gnump3d_flags=${gnump3d_flags:-"--quiet --background"}
gnump3d_pidfile=${gnump3d_pidfile:-/var/run/gnump3d/gnump3d.pid}
case $1 in
start)
case "${gnump3d_enable}" in
[Yy][Ee][Ss])
if [ -f ${gnump3d_program} ]; then
echo -n " gnump3d"
${gnump3d_program} ${gnump3d_flags} || return=" Failed."
echo `ps auwx | grep -E 'perl.*gnump3d' | grep -v grep | awk '{print $2}'` > $gnump3d_pidfile
fi
;;
esac
;;
forcestart)
if [ -f ${gnump3d_program} ]; then
echo -n " gnump3d"
${gnump3d_program} ${gnump3d_flags} || return=" Failed."
echo `ps auwx | grep -E 'perl.*gnump3d' | grep -v grep | awk '{print $2}'` > $gnump3d_pidfile
fi
;;
stop)
if [ -f ${gnump3d_pidfile} ]; then
PID=`cat ${gnump3d_pidfile}`
kill -KILL $PID || return=" Failed."
rm -f ${gnump3d_pidfile}
# some slaves won't die
killall gnump3d > /dev/null 2>&1
echo " gnump3d killed"
else
return=" Failed."
fi
;;
forcestop)
if [ -f ${gnump3d_pidfile} ]; then
PID=`cat ${gnump3d_pidfile}`
kill -KILL $PID || return=" Failed."
rm -f ${gnump3d_pidfile}
# some slaves won't die
killall gnump3d > /dev/null 2>&1
echo " gnump3d killed"
else
return=" Failed."
fi
;;
restart)
$0 stop
$0 start;
;;
*)
echo "usage: $0 {start|stop|restart}" 1>&2
;;
esac
exit 0;
--- gnump3d.sh ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list