mirror of https://github.com/zulip/zulip.git
puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_send_receive_time: Avoid shelling out for mv.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
f15cef27db
commit
dbe65231fc
|
@ -11,7 +11,6 @@ Django ORM.
|
|||
import sys
|
||||
import argparse
|
||||
import random
|
||||
import subprocess
|
||||
import time
|
||||
import traceback
|
||||
import os
|
||||
|
@ -100,7 +99,7 @@ def report(state, timestamp=None, msg=None):
|
|||
state_file_path = "/var/lib/nagios_state/check_send_receive_state"
|
||||
with open(state_file_path + ".tmp", 'w') as f:
|
||||
f.write("%s|%s|%s|%s\n" % (now, states[state], state, msg))
|
||||
subprocess.check_call(["mv", state_file_path + ".tmp", state_file_path])
|
||||
os.rename(state_file_path + ".tmp", state_file_path)
|
||||
print("%s: %s" % (state, msg))
|
||||
exit(states[state])
|
||||
|
||||
|
|
Loading…
Reference in New Issue