summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/sensorsd/sensorsd.814
-rw-r--r--usr.sbin/sensorsd/sensorsd.c23
2 files changed, 30 insertions, 7 deletions
diff --git a/usr.sbin/sensorsd/sensorsd.8 b/usr.sbin/sensorsd/sensorsd.8
index 50a05c21a2d..84b23b5e9c1 100644
--- a/usr.sbin/sensorsd/sensorsd.8
+++ b/usr.sbin/sensorsd/sensorsd.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sensorsd.8,v 1.16 2007/08/11 20:45:35 cnst Exp $
+.\" $OpenBSD: sensorsd.8,v 1.17 2007/11/28 17:03:59 tedu Exp $
.\"
.\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
.\" Copyright (c) 2005 Matthew Gream <matthew.gream@pobox.com>
@@ -16,7 +16,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: August 11 2007 $
+.Dd $Mdocdate: November 28 2007 $
.Dt SENSORSD 8
.Os
.Sh NAME
@@ -25,6 +25,8 @@
.Sh SYNOPSIS
.Nm sensorsd
.Op Fl d
+.Op Fl c Ar check
+.Op Fl r Ar report
.Sh DESCRIPTION
The
.Nm
@@ -62,6 +64,14 @@ Do not daemonize.
If this option is specified,
.Nm
will run in the foreground.
+.It Fl c Ar check
+Check sensors every
+.Ar check
+seconds.
+.It Fl r Ar report
+Report changes in sensor status every
+.Ar report
+seconds.
.El
.Sh FILES
.Bl -tag -width "/etc/sensorsd.conf"
diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c
index 41bd50a0200..995a8639321 100644
--- a/usr.sbin/sensorsd/sensorsd.c
+++ b/usr.sbin/sensorsd/sensorsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensorsd.c,v 1.34 2007/08/14 17:10:02 cnst Exp $ */
+/* $OpenBSD: sensorsd.c,v 1.35 2007/11/28 17:03:59 tedu Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -96,7 +96,7 @@ void
usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-d]\n", __progname);
+ fprintf(stderr, "usage: %s [-d] [-c check] [-r report]\n", __progname);
exit(1);
}
@@ -109,12 +109,25 @@ main(int argc, char *argv[])
time_t next_report, last_report = 0, next_check;
int mib[3], dev;
int sleeptime, sensor_cnt = 0, ch;
+ int check_period = CHECK_PERIOD;
+ int report_period = REPORT_PERIOD;
+ const char *errstr;
- while ((ch = getopt(argc, argv, "d")) != -1) {
+ while ((ch = getopt(argc, argv, "c:dr:")) != -1) {
switch (ch) {
+ case 'c':
+ check_period = strtonum(optarg, 1, 600, &errstr);
+ if (errstr)
+ errx(1, "check %s", errstr);
+ break;
case 'd':
debug = 1;
break;
+ case 'r':
+ report_period = strtonum(optarg, 1, 600, &errstr);
+ if (errstr)
+ errx(1, "report %s", errstr);
+ break;
default:
usage();
}
@@ -163,12 +176,12 @@ main(int argc, char *argv[])
}
if (next_check <= time(NULL)) {
check();
- next_check = time(NULL) + CHECK_PERIOD;
+ next_check = time(NULL) + check_period;
}
if (next_report <= time(NULL)) {
report(last_report);
last_report = next_report;
- next_report = time(NULL) + REPORT_PERIOD;
+ next_report = time(NULL) + report_period;
}
if (next_report < next_check)
sleeptime = next_report - time(NULL);