Révision bb4d6c64
fix uptime_bsd. compile time is not included since FreeBSD 12.0-RELEASE due to Reproducible Builds
https://wiki.freebsd.org/ReproducibleBuilds/Base
https://reviews.freebsd.org/D4347
sysctl output samples:
% (11.2-RELEASE) sysctl kern.version
kern.version: FreeBSD 11.2-RELEASE-p10 #0: Mon May 13 21:20:50 UTC 2019
root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC
% (12.0-RELEASE) sysctl kern.version
kern.version: FreeBSD 12.0-RELEASE-p7 GENERIC
| plugins/bsd/uptime_bsd | ||
|---|---|---|
| 48 | 48 |
my $kern=`sysctl -n kern.version`; |
| 49 | 49 |
$kern=~ /:\s+(.*\S)\s+\w+\@/; |
| 50 | 50 |
#print "Compile: $1\n"; |
| 51 |
$kern=str2time($1);
|
|
| 51 |
$kern= $1 ? str2time($1) : undef;
|
|
| 52 | 52 |
|
| 53 | 53 |
my $boot=`sysctl -n kern.boottime`; # OpenBSD will return seconds from the epoch |
| 54 | 54 |
if ($ostype ne "OpenBSD") {
|
| ... | ... | |
| 59 | 59 |
|
| 60 | 60 |
my $now=time; |
| 61 | 61 |
|
| 62 |
print "compile.value ",($now-$kern)/60/60/24,"\n"; |
|
| 62 |
print "compile.value ",($now-$kern)/60/60/24,"\n" if $kern;
|
|
| 63 | 63 |
print "uptime.value ",($now-$boot)/60/60/24,"\n"; |
Formats disponibles : Unified diff