[Git][NTPsec/ntpsec][master] Changed default wait time from 5 to 60 seconds. Simplified the code for a single run.
deamoneye
gitlab at mg.gitlab.com
Tue Jan 24 02:09:59 UTC 2017
deamoneye pushed to branch master at NTPsec / ntpsec
Commits:
913da469 by Keane Wolter at 2017-01-23T21:09:47-05:00
Changed default wait time from 5 to 60 seconds. Simplified the code for a single run.
- - - - -
1 changed file:
- contrib/temp-log.py
Changes:
=====================================
contrib/temp-log.py
=====================================
--- a/contrib/temp-log.py
+++ b/contrib/temp-log.py
@@ -121,9 +121,9 @@ parser.add_argument('-V', '--version',
action="version",
version="temp-log %s" % ntp.util.stdversion())
parser.add_argument('-w', '--wait',
- default=[5],
+ default=[60],
dest='wait',
- help="Set delay time in seconds, default is 5",
+ help="Set delay time in seconds, default is 60",
nargs=1,
type=int)
args = parser.parse_args()
@@ -203,11 +203,13 @@ def log_data():
logData(Logger, "# Values are space seperated")
logData(Logger, "# seconds since epoc, sensor, sensor value")
- # Write data to their respective logs forever
+ # Write data to their respective logs
while True:
logData(Logger, zone.get_data())
logData(Logger, cpu.get_data())
logData(Logger, hdd.get_data())
+ if args.once:
+ sys.exit(0)
time.sleep(args.wait[0])
@@ -241,28 +243,11 @@ def display():
logData(Logger, zone.get_data())
logData(Logger, cpu.get_data())
logData(Logger, hdd.get_data())
+ if args.once:
+ sys.exit(0)
time.sleep(args.wait[0])
-def one_output():
- "Run the output once"
- try:
- # Create objects
- cpu = CpuTemp()
- zone = ZoneTemp()
- hdd = SmartCtl()
- except IOError as ioe:
- sys.stderr.write("Unable to run: " + str(ioe) + "\n")
- sys.exit(1)
- Logger = console_log_setup(logging.INFO)
- # Create data layout
- logData(Logger, "# Values are space seperated")
- logData(Logger, "# seconds since epoc, sensor, sensor value")
- logData(Logger, zone.get_data())
- logData(Logger, cpu.get_data())
- logData(Logger, hdd.get_data())
-
-
args = parser.parse_args()
if args.logfile:
try:
@@ -270,9 +255,6 @@ if args.logfile:
log_data()
except (KeyboardInterrupt, SystemExit):
sys.exit(0)
-elif args.once:
- one_output()
- sys.exit(0)
else:
try:
display()
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/913da469f1aab623f7fbaeaaffb62f893ecbf6d2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170124/6e4a6999/attachment.html>
More information about the vc
mailing list