aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew@FreeBSD.org>2016-10-26 15:01:15 +0800
committermatthew <matthew@FreeBSD.org>2016-10-26 15:01:15 +0800
commite909ff7a5a93aa931235f99bc33e7470e7306f11 (patch)
tree710f867c920b2a518aed3b18d184cb6484fed241
parent8fc593225ca9c25b0319e8c560e78c5a5801553d (diff)
downloadfreebsd-ports-gnome-e909ff7a5a93aa931235f99bc33e7470e7306f11.tar.gz
freebsd-ports-gnome-e909ff7a5a93aa931235f99bc33e7470e7306f11.tar.zst
freebsd-ports-gnome-e909ff7a5a93aa931235f99bc33e7470e7306f11.zip
Improve RTG port
Summary: Add 'rtg' user and group in UIDs/GIDs. Use daemon(8) to daemonize rtgpoll. Add prestart commands to set correct permissions for RTG's files. Reviewers: swills, allanjude, xmj, andrew.fengler_scaleengine.com, #contributor_reviewers_ports, matthew Reviewed By: #contributor_reviewers_ports, matthew Subscribers: matthew, mat Differential Revision: https://reviews.freebsd.org/D7486
-rw-r--r--GIDs2
-rw-r--r--UIDs2
-rw-r--r--net/rtg/Makefile19
-rw-r--r--net/rtg/files/patch-config-config.h.in4
-rw-r--r--net/rtg/files/patch-configure12
-rw-r--r--net/rtg/files/patch-etc-95.php14
-rw-r--r--net/rtg/files/patch-etc-Makefile.in8
-rw-r--r--net/rtg/files/patch-etc-rtg.php16
-rw-r--r--net/rtg/files/patch-etc-rtgtargmkr.pl.in6
-rw-r--r--net/rtg/files/patch-etc-view.php4
-rw-r--r--net/rtg/files/patch-man-rtgplot.18
-rw-r--r--net/rtg/files/patch-man-rtgpoll.16
-rw-r--r--net/rtg/files/patch-src-rtg.h4
-rw-r--r--net/rtg/files/patch-src-rtgplot.c14
-rw-r--r--net/rtg/files/patch-src-rtgpoll.c16
-rw-r--r--net/rtg/files/rtgpoll.in20
16 files changed, 84 insertions, 71 deletions
diff --git a/GIDs b/GIDs
index a9db126155ee..1c90ffa2dd09 100644
--- a/GIDs
+++ b/GIDs
@@ -219,7 +219,7 @@ meta1:*:264:
haclient:*:275:
frontbase:*:276:
# free: 277
-# free: 278
+rtg:*:278:
mrtg:*:279:
xymon:*:280:
prelude:*:281:
diff --git a/UIDs b/UIDs
index 2df47eadb82e..edb270fee12e 100644
--- a/UIDs
+++ b/UIDs
@@ -224,7 +224,7 @@ meta1:*:264:264::0:0:MeTA1 other:/nonexistent:/usr/sbin/nologin
hacluster:*:275:275::0:0:Heartbeat cluster user:/nonexistent:/usr/sbin/nologin
frontbase:*:276:276::0:0:FrontBase Daemon:/usr/local/FrontBase/Databases:/bin/sh
# free: 277
-# free: 278
+rtg:*:278:278::0:0:RTG daemon:/nonexistent:/usr/sbin/nologin
mrtg:*:279:279::0:0:MRTG daemon:/nonexistent:/usr/sbin/nologin
xymon:*:280:280::0:0:Xymon Monitor:/nonexistent:/usr/sbin/nologin
prelude:*:281:281::0:0:Prelude user:/nonexistent:/usr/sbin/nologin
diff --git a/net/rtg/Makefile b/net/rtg/Makefile
index ad8759bb095c..693c65825172 100644
--- a/net/rtg/Makefile
+++ b/net/rtg/Makefile
@@ -3,7 +3,7 @@
PORTNAME= rtg
PORTVERSION= 0.7.4
-PORTREVISION= 12
+PORTREVISION= 13
CATEGORIES= net
MASTER_SITES= SF \
ftp://ftpmirror.uk/freebsd-ports/rtg/
@@ -18,30 +18,27 @@ RUN_DEPENDS= p5-DBI>=0:databases/p5-DBI \
p5-DBD-mysql>=0:databases/p5-DBD-mysql
USE_RC_SUBR= rtgpoll
-USE_MYSQL= client
WANT_PERL= yes
-USES= shebangfix
+USES= shebangfix mysql:client
SHEBANG_FILES= etc/95.pl etc/report.pl etc/rtgtargmkr.pl.in
SUB_FILES= pkg-message
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc/${PORTNAME} \
--with-mysql=${LOCALBASE} \
--with-snmp=${LOCALBASE}
+
+USERS= rtg
+GROUPS= rtg
+
OPTIONS_DEFINE= WEB MYSQL
OPTIONS_DEFAULT=WEB
MYSQL_DESC= Pull MySQL server in as a dependancy for local setups
WEB_DESC= Include PHP-based web client interface pre-requisites
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MMYSQL}
-USE_MYSQL= yes
-.endif
+MYSQL_USES= mysql:server
-.if ${PORT_OPTIONS:MWEB}
-WANT_PHP_WEB= yes
+WEB_USES= php
USE_PHP= mysqli spl
-.endif
CFLAGS+= -fstack-protector
LDFLAGS+= -fstack-protector
diff --git a/net/rtg/files/patch-config-config.h.in b/net/rtg/files/patch-config-config.h.in
index c47cc9d8ef1a..3c624c4c1b14 100644
--- a/net/rtg/files/patch-config-config.h.in
+++ b/net/rtg/files/patch-config-config.h.in
@@ -1,5 +1,5 @@
---- config/config.h.in.orig Thu Sep 25 08:21:14 2003
-+++ config/config.h.in Sat May 14 01:31:47 2005
+--- config/config.h.in.orig 2003-09-25 15:21:14 UTC
++++ config/config.h.in
@@ -91,19 +91,19 @@
#undef PACKAGE
diff --git a/net/rtg/files/patch-configure b/net/rtg/files/patch-configure
index c5c6f5bd80df..7739ecc6ad12 100644
--- a/net/rtg/files/patch-configure
+++ b/net/rtg/files/patch-configure
@@ -1,6 +1,6 @@
---- configure.ori Tue Jan 6 22:43:17 2004
-+++ configure Tue Jan 6 22:47:06 2004
-@@ -328,6 +328,8 @@
+--- configure.orig 2003-10-02 15:59:33 UTC
++++ configure
+@@ -328,6 +328,8 @@ sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
@@ -9,7 +9,7 @@
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
-@@ -558,6 +560,12 @@
+@@ -558,6 +560,12 @@ do
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
@@ -22,7 +22,7 @@
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-@@ -654,7 +662,8 @@
+@@ -654,7 +662,8 @@ done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
@@ -32,7 +32,7 @@
do
eval ac_val=$`echo $ac_var`
case $ac_val in
-@@ -5310,6 +5319,8 @@
+@@ -5310,6 +5319,8 @@ s,@sbindir@,$sbindir,;t t
s,@libexecdir@,$libexecdir,;t t
s,@datadir@,$datadir,;t t
s,@sysconfdir@,$sysconfdir,;t t
diff --git a/net/rtg/files/patch-etc-95.php b/net/rtg/files/patch-etc-95.php
index e6213745d75b..9831f54f01cc 100644
--- a/net/rtg/files/patch-etc-95.php
+++ b/net/rtg/files/patch-etc-95.php
@@ -1,5 +1,5 @@
---- etc/95.php.orig 2014-06-22 15:27:55.587467922 +0100
-+++ etc/95.php 2014-06-22 15:28:47.947474934 +0100
+--- etc/95.php.orig 2003-09-24 20:40:57 UTC
++++ etc/95.php
@@ -4,10 +4,8 @@
print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
@@ -12,7 +12,7 @@
if ($PHP_SELF == "") {
$PHP_SELF = "95.php";
-@@ -50,8 +48,8 @@
+@@ -50,8 +48,8 @@ function int_stats($statement, $dbc) {
$max = $avg = $nintyfifth = 0;
$rate = array();
@@ -23,7 +23,7 @@
$counter = $selectRow->counter;
$sample_secs = $selectRow->unixtime;
$total += $counter;
-@@ -89,9 +87,8 @@
+@@ -89,9 +87,8 @@ Report: 95th percentile<BR>
<?php
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
if (($bt || $smonth)) {
@@ -35,7 +35,7 @@
/* Format into GNU date syntax */
if ($bt == "") {
$bt = strtotime("$syear-$smonth-$sday $shour:$smin:00");
-@@ -104,11 +101,11 @@
+@@ -104,11 +101,11 @@ Report: 95th percentile<BR>
$range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
$selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\"";
@@ -50,7 +50,7 @@
$ids[$selectRow->id] = $selectRow->name;
$rids[$selectRow->id] = $selectRow->rid;
$desc[$selectRow->id] = $selectRow->description;
-@@ -127,8 +124,8 @@
+@@ -127,8 +124,8 @@ Report: 95th percentile<BR>
foreach($ids as $iid=>$name) {
$selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]";
@@ -61,7 +61,7 @@
$router = $selectRow->name;
if ($yellow) $yellow = 0;
-@@ -201,7 +198,7 @@
+@@ -201,7 +198,7 @@ Report: 95th percentile<BR>
echo "<P><INPUT TYPE=\"SUBMIT\" VALUE=\"Ok\">";
}
diff --git a/net/rtg/files/patch-etc-Makefile.in b/net/rtg/files/patch-etc-Makefile.in
index bd501098bad9..b7e64a203715 100644
--- a/net/rtg/files/patch-etc-Makefile.in
+++ b/net/rtg/files/patch-etc-Makefile.in
@@ -1,6 +1,6 @@
---- etc/Makefile.in.orig 2003-10-02 16:59:32.000000000 +0100
-+++ etc/Makefile.in 2014-05-10 17:29:11.995407415 +0100
-@@ -84,19 +84,19 @@
+--- etc/Makefile.in.orig 2003-10-02 15:59:32 UTC
++++ etc/Makefile.in
+@@ -84,19 +84,19 @@ am__quote = @am__quote@
install_sh = @install_sh@
top_builddir = ..
@@ -26,7 +26,7 @@
subdir = etc
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
-@@ -220,14 +220,14 @@
+@@ -220,14 +220,14 @@ uninstall-am: uninstall-info-am
all:
install: installdirs
diff --git a/net/rtg/files/patch-etc-rtg.php b/net/rtg/files/patch-etc-rtg.php
index f8e8cf5d0ae3..524ce7699fc5 100644
--- a/net/rtg/files/patch-etc-rtg.php
+++ b/net/rtg/files/patch-etc-rtg.php
@@ -1,5 +1,5 @@
---- etc/rtg.php.orig 2003-09-24 21:42:03.000000000 +0100
-+++ etc/rtg.php 2014-06-22 15:25:22.471477252 +0100
+--- etc/rtg.php.orig 2003-09-24 20:42:03 UTC
++++ etc/rtg.php
@@ -4,10 +4,8 @@
print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
@@ -35,7 +35,7 @@
$router = $selectRow->router;
}
-@@ -71,8 +69,8 @@
+@@ -71,8 +69,8 @@ echo "<FORM ACTION=\"$PHP_SELF\" METHOD=
if (!$rid && !$iid) {
echo "<SELECT NAME=\"rid\" SIZE=10>\n";
$selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name";
@@ -46,7 +46,7 @@
echo "<OPTION VALUE=\"$selectRow->rid\">$selectRow->name\n";
}
echo "</SELECT>\n";
-@@ -91,8 +89,8 @@
+@@ -91,8 +89,8 @@ if ($rid && !$iid) {
echo "<SELECT MULTIPLE NAME=\"iid[]\" SIZE=10>\n";
$selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid ORDER BY name";
@@ -57,7 +57,7 @@
echo "<OPTION VALUE=\"$selectRow->id\">$selectRow->name ($selectRow->description)\n";
}
echo "</SELECT>\n";
-@@ -152,8 +150,8 @@
+@@ -152,8 +150,8 @@ if (($bt || $smonth) && $iid) {
$range="$range AND id=$iid[0]";
$selectQuery="SELECT description, name, speed FROM interface WHERE rid=$rid AND id=$iid[0]";
@@ -68,7 +68,7 @@
echo "<TABLE BORDER=0>\n";
echo "<TD><I>Device</I>:</TD><TD>$router ($rid)</TD><TR>\n";
echo "<TD><I>Interface</I>:</TD><TD>$selectRow->name ($iid[0])</TD><TR>\n";
-@@ -165,12 +163,15 @@
+@@ -165,12 +163,15 @@ if (($bt || $smonth) && $iid) {
echo "<P>\n";
#$selectQuery="SELECT DISTINCT id FROM ifInOctets_$rid WHERE $range";
@@ -86,7 +86,7 @@
foreach ($iid as $value) {
$args="$args&iid=$value";
}
-@@ -181,8 +182,11 @@
+@@ -181,8 +182,11 @@ if (($bt || $smonth) && $iid) {
if ($borderb) $args = "$args&borderb=$borderb";
if ($aggr) $args = "$args&aggr=yes";
if ($percentile) $args = "$args&percentile=$nth";
@@ -99,7 +99,7 @@
foreach ($iid as $value) {
$args="$args&iid=$value";
}
-@@ -192,13 +196,17 @@
+@@ -192,13 +196,17 @@ if (($bt || $smonth) && $iid) {
if ($borderb) $args = "$args&borderb=$borderb";
if ($aggr) $args = "$args&aggr=yes";
if ($percentile) $args = "$args&percentile=$nth";
diff --git a/net/rtg/files/patch-etc-rtgtargmkr.pl.in b/net/rtg/files/patch-etc-rtgtargmkr.pl.in
index 318b3c3e06e7..6cb990be9404 100644
--- a/net/rtg/files/patch-etc-rtgtargmkr.pl.in
+++ b/net/rtg/files/patch-etc-rtgtargmkr.pl.in
@@ -1,6 +1,6 @@
---- etc/rtgtargmkr.pl.in.orig 2010-04-21 20:55:58.903081619 +0100
-+++ etc/rtgtargmkr.pl.in 2010-04-21 20:56:15.567832088 +0100
-@@ -126,7 +126,7 @@
+--- etc/rtgtargmkr.pl.in.orig 2016-10-25 16:28:59 UTC
++++ etc/rtgtargmkr.pl.in
+@@ -126,7 +126,7 @@ sub find_router_id {
&sql_insert($sql);
$rid = &find_router_id($router);
foreach $mib ( keys %mibs_of_interest ) {
diff --git a/net/rtg/files/patch-etc-view.php b/net/rtg/files/patch-etc-view.php
index a3d4af95ee37..1642c221c356 100644
--- a/net/rtg/files/patch-etc-view.php
+++ b/net/rtg/files/patch-etc-view.php
@@ -1,5 +1,5 @@
---- etc/view.php.orig 2003-09-26 16:58:34.000000000 +0100
-+++ etc/view.php 2014-06-22 15:24:14.720483023 +0100
+--- etc/view.php.orig 2003-09-26 15:58:34 UTC
++++ etc/view.php
@@ -11,10 +11,8 @@
print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
diff --git a/net/rtg/files/patch-man-rtgplot.1 b/net/rtg/files/patch-man-rtgplot.1
index bc7c82204893..6ccca28ba90f 100644
--- a/net/rtg/files/patch-man-rtgplot.1
+++ b/net/rtg/files/patch-man-rtgplot.1
@@ -1,5 +1,5 @@
---- man/rtgplot.1.orig 2010-04-21 09:04:22.473988200 +0100
-+++ man/rtgplot.1 2010-04-21 09:08:22.862400825 +0100
+--- man/rtgplot.1.orig 2003-09-25 04:10:36 UTC
++++ man/rtgplot.1
@@ -10,7 +10,8 @@
-t tablename(s) -i interface(s) [options] begin end
.br
@@ -10,7 +10,7 @@
.SH DESCRIPTION
.I rtgplot
generates traffic plots of RTG data in PNG format. It operates in
-@@ -82,14 +83,19 @@
+@@ -82,14 +83,19 @@ pixels.
Set plot bottom border to
.RI <size>
pixels.
@@ -32,7 +32,7 @@
.PP
will plot two lines from the MySQL tables ifInOctets_2 and ifOutOctets_2
corresponding to interface 4 on router 2 for the time span 1046754000 to
-@@ -97,6 +103,8 @@
+@@ -97,6 +103,8 @@ corresponding to interface 4 on router 2
second; the units argument is displayed as the Y-axis label on the plot.
The scalex argument auto-adjusts the X time axis according to the available
data samples rather than according to the actual time span given.
diff --git a/net/rtg/files/patch-man-rtgpoll.1 b/net/rtg/files/patch-man-rtgpoll.1
index d3c466ec4114..1c15b64d830c 100644
--- a/net/rtg/files/patch-man-rtgpoll.1
+++ b/net/rtg/files/patch-man-rtgpoll.1
@@ -1,6 +1,6 @@
---- man/rtgpoll.1.orig 2010-07-04 03:46:36.586762545 +0100
-+++ man/rtgpoll.1 2010-07-04 03:48:19.872644629 +0100
-@@ -31,6 +31,9 @@
+--- man/rtgpoll.1.orig 2003-09-24 17:26:57 UTC
++++ man/rtgpoll.1
+@@ -31,6 +31,9 @@ Disable database inserts.
.IR "\-m"
Skip checking for multiple instances.
.TP
diff --git a/net/rtg/files/patch-src-rtg.h b/net/rtg/files/patch-src-rtg.h
index b9282d8127a7..72730abc7017 100644
--- a/net/rtg/files/patch-src-rtg.h
+++ b/net/rtg/files/patch-src-rtg.h
@@ -1,5 +1,5 @@
---- src/rtg.h.orig 2010-04-21 21:26:38.587554904 +0100
-+++ src/rtg.h 2010-04-21 21:31:40.436052227 +0100
+--- src/rtg.h.orig 2003-09-25 15:56:04 UTC
++++ src/rtg.h
@@ -42,9 +42,7 @@
#define DEFAULT_DB_PASS "rtgdefault"
#define DEFAULT_SNMP_VER 1
diff --git a/net/rtg/files/patch-src-rtgplot.c b/net/rtg/files/patch-src-rtgplot.c
index 791d81967f37..3808954e15f3 100644
--- a/net/rtg/files/patch-src-rtgplot.c
+++ b/net/rtg/files/patch-src-rtgplot.c
@@ -1,6 +1,6 @@
---- src/rtgplot.c.orig 2003-10-02 16:27:52.000000000 +0100
-+++ src/rtgplot.c 2010-07-04 03:45:21.927295776 +0100
-@@ -221,7 +221,10 @@
+--- src/rtgplot.c.orig 2003-10-02 15:27:52 UTC
++++ src/rtgplot.c
+@@ -221,7 +221,10 @@ int main(int argc, char **argv) {
plot_line(data[i][j], &img, &graph, colors->shade, TRUE);
else
plot_line(data[i][j], &img, &graph, colors->shade, FALSE);
@@ -12,7 +12,7 @@
plot_legend(&img, rate[i][j], &graph, colors->shade, intname, offset);
offset++;
}
-@@ -629,15 +632,15 @@
+@@ -629,15 +632,15 @@ void plot_legend(gdImagePtr * img, rate_
if (set.verbose >= HIGH)
fprintf(dfp, "Plotting legend (%s).\n", __FUNCTION__);
@@ -34,7 +34,7 @@
}
snprintf(string, sizeof(string), "%s", interface);
for (i = 0; i < (17 - strlen(interface)); i++) {
-@@ -662,7 +665,7 @@
+@@ -662,7 +665,7 @@ void plot_legend(gdImagePtr * img, rate_
units(rate.cur, cur), graph->units,
units((float)rate.total, total));
}
@@ -43,7 +43,7 @@
BORDER_T + graph->image.yplot_area + 33 + (10 * offset), string, std_colors[black]);
}
-@@ -866,6 +869,13 @@
+@@ -866,6 +869,13 @@ void plot_labels(gdImagePtr * img, graph
title_offset = 1 - (0.01 * (strlen(VERSION) + strlen(COPYRIGHT) + 2));
snprintf(string, sizeof(string), "%s %s", COPYRIGHT, VERSION);
gdImageString(*img, gdFontSmall, BORDER_L + (graph->image.xplot_area * title_offset), BORDER_T - 15, string, std_colors[black]);
@@ -57,7 +57,7 @@
}
-@@ -1342,10 +1352,14 @@
+@@ -1342,10 +1352,14 @@ void parseWeb(arguments_t *arguments, gr
}
}
/* XXX REB - Warning: Deprecated, tN argument will go away in RTG 0.8 XXX */
diff --git a/net/rtg/files/patch-src-rtgpoll.c b/net/rtg/files/patch-src-rtgpoll.c
index 4877381bc25e..c55df98b6aa1 100644
--- a/net/rtg/files/patch-src-rtgpoll.c
+++ b/net/rtg/files/patch-src-rtgpoll.c
@@ -1,5 +1,5 @@
---- src/rtgpoll.c.orig 2010-04-21 21:24:13.686718318 +0100
-+++ src/rtgpoll.c 2010-04-21 21:33:53.755065067 +0100
+--- src/rtgpoll.c.orig 2003-09-25 15:56:04 UTC
++++ src/rtgpoll.c
@@ -13,6 +13,7 @@
stats_t stats =
{PTHREAD_MUTEX_INITIALIZER, 0, 0, 0, 0, 0, 0, 0, 0, 0.0};
@@ -8,7 +8,7 @@
target_t *current = NULL;
MYSQL mysql;
int entries = 0;
-@@ -41,7 +42,7 @@
+@@ -41,7 +42,7 @@ int main(int argc, char *argv[]) {
config_defaults(&set);
/* Parse the command-line. */
@@ -17,7 +17,7 @@
switch ((char) ch) {
case 'c':
conf_file = optarg;
-@@ -55,6 +56,9 @@
+@@ -55,6 +56,9 @@ int main(int argc, char *argv[]) {
case 'm':
set.multiple++;
break;
@@ -27,7 +27,7 @@
case 't':
target_file = optarg;
break;
-@@ -66,6 +70,9 @@
+@@ -66,6 +70,9 @@ int main(int argc, char *argv[]) {
break;
}
@@ -37,7 +37,7 @@
if (set.verbose >= LOW)
printf("RTG version %s starting.\n", VERSION);
-@@ -78,7 +85,7 @@
+@@ -78,7 +85,7 @@ int main(int argc, char *argv[]) {
sigaddset(&signal_set, SIGINT);
sigaddset(&signal_set, SIGQUIT);
if (!set.multiple)
@@ -46,7 +46,7 @@
if (pthread_sigmask(SIG_BLOCK, &signal_set, NULL) != 0)
printf("pthread_sigmask error\n");
-@@ -244,7 +251,7 @@
+@@ -244,7 +251,7 @@ void *sig_handler(void *arg)
if (set.verbose >= LOW)
printf("Quiting: received signal %d.\n", sig_number);
rtg_dbdisconnect(&mysql);
@@ -55,7 +55,7 @@
exit(1);
break;
}
-@@ -259,6 +266,7 @@
+@@ -259,6 +266,7 @@ void usage(char *prog)
printf("\nOptions:\n");
printf(" -c <file> Specify configuration file\n");
printf(" -d Disable database inserts\n");
diff --git a/net/rtg/files/rtgpoll.in b/net/rtg/files/rtgpoll.in
index 02ee3ed7a9f6..73c1d482ac57 100644
--- a/net/rtg/files/rtgpoll.in
+++ b/net/rtg/files/rtgpoll.in
@@ -21,7 +21,8 @@
name="rtgpoll"
rcvar=rtgpoll_enable
-command=%%PREFIX%%/bin/${name}
+cmd=%%PREFIX%%/bin/${name}
+command="/usr/sbin/daemon"
load_rc_config $name
@@ -29,10 +30,25 @@ load_rc_config $name
: ${rtgpoll_config="%%PREFIX%%/etc/rtg/rtg.conf"}
: ${rtgpoll_targets="%%PREFIX%%/etc/rtg/targets.cfg"}
: ${rtgpoll_pidfile="/var/run/${name}.pid"}
+: ${rtgpoll_user="rtg"}
+: ${rtgpoll_group="rtg"}
required_files="$rtgpoll_targets"
-command_args="-p $rtgpoll_pidfile -c $rtgpoll_config -t $rtgpoll_targets &"
+command_args="-f -p $rtgpoll_pidfile $cmd -c $rtgpoll_config -t $rtgpoll_targets"
+
+start_precmd="rtgpoll_prestart"
+
+rtgpoll_prestart() {
+ if [ ! -e "${rtgpoll_pidfile}" ]; then
+ touch $rtgpoll_pidfile
+ fi
+
+ chown "${rtgpoll_user}:${rtgpoll_group}" "$rtgpoll_pidfile"
+ chmod 640 "$rtgpoll_pidfile"
+ chown -R "${rtgpoll_user}:${rtgpoll_group}" "%%PREFIX%%/etc/rtg"
+ chmod -R u+rwX,g+rX "%%PREFIX%%/etc/rtg"
+}
run_rc_command "$1"