1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-02 06:03:50 +00:00

- Improve rc scipts

Submitted by:	glebius@freebsd.org (via email)
This commit is contained in:
Wen Heping 2010-05-28 00:52:25 +00:00
parent d3b77479f4
commit 68e235b88f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=255217
2 changed files with 34 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= gpsd
PORTVERSION= 2.94
PORTREVISION= 1
CATEGORIES= astro geography
MASTER_SITES= ${MASTER_SITE_BERLIOS}
MASTER_SITE_SUBDIR= ${PORTNAME}

View File

@ -26,15 +26,48 @@
name=gpsd
rcvar=`set_rcvar`
start_postcmd=start_postcmd
stop_postcmd=stop_postcmd
start_postcmd()
{
if ! checkyesno gpxlogger_enable; then
return;
fi
cd ${gpxlogger_logdir};
gpx=$(date +"${gpxlogger_format}")
touch "${pidfile_logger}" "${gpx}"
chown nobody:nobody "${pidfile_logger}" "${gpx}"
/usr/sbin/daemon -u nobody -p "${pidfile_logger}" \
${gpxlogger} ${gpxlogger_flags} > ${gpx}
}
stop_postcmd()
{
if ! checkyesno gpxlogger_enable; then
return;
fi
/bin/kill $(/bin/cat "${pidfile_logger}")
}
load_rc_config $name
# Set defaults
: ${gpsd_enable:="NO"}
: ${gpsd_flags:=""}
: ${gpsd_devices:=""}
: ${gpxlogger_enable:="NO"}
: ${gpxlogger_flags:="-i 600"}
: ${gpxlogger_logdir:="/var/log"}
: ${gpxlogger_format:="%d %B %Y - %H:%M.gpx"}
pidfile=/var/run/$name.pid
command=%%PREFIX%%/sbin/$name
command_args="-P $pidfile $gpsd_devices"
gpxlogger=/usr/local/bin/gpxlogger
pidfile_logger=/var/run/gpxlogger.pid
run_rc_command "$1"