added gstat.err to Popen

This commit is contained in:
Marc Mance
2024-08-02 16:35:59 -04:00
parent 6e79655a28
commit d6c062b73d

View File

@@ -385,10 +385,6 @@ def welcome():
print("")
def is_two_digit_number(number):
return 10 <= number < 100
def main():
welcome()
@@ -446,9 +442,14 @@ def main():
"15s",
]
with open("gstat.csv", "a") as output_file:
# Create a Popen object with stdout redirected to the file
process = subprocess.Popen(gstat_command, stdout=output_file)
gstatData = open("gstat.csv", "a")
gstatError = open("gstat.err", "a")
# with as output_file:
# # Create a Popen object with stdout redirected to the file
process = subprocess.Popen(
gstat_command, stdout=gstatData, stderr=gstatError
)
collect_data(minutes)
@@ -456,6 +457,8 @@ def main():
if is_freebsd():
process.terminate()
process.kill()
gstatData.close()
gstatError.close()
except KeyboardInterrupt:
print("Caught Ctrl-C, cancelling collection...")
@@ -463,6 +466,9 @@ def main():
if is_freebsd():
process.terminate()
process.kill()
gstatData.close()
gstatError.close()
exit()
# Copy data files to /var/log (replace with appropriate copying function)