Send report just before reboot
This commit is contained in:
@@ -68,6 +68,10 @@ class Client(threadedclient.WebSocketClient):
|
|||||||
self.connect()
|
self.connect()
|
||||||
self._OnNewManifest2()
|
self._OnNewManifest2()
|
||||||
while True:
|
while True:
|
||||||
|
self._SendReport()
|
||||||
|
time.sleep(5.0)
|
||||||
|
|
||||||
|
def _SendReport(self):
|
||||||
report = {
|
report = {
|
||||||
'hostname': socket.gethostname(),
|
'hostname': socket.gethostname(),
|
||||||
'uptime_seconds': self._Uptime(),
|
'uptime_seconds': self._Uptime(),
|
||||||
@@ -78,8 +82,7 @@ class Client(threadedclient.WebSocketClient):
|
|||||||
self.send(json.dumps({
|
self.send(json.dumps({
|
||||||
'type': 'report',
|
'type': 'report',
|
||||||
'data': report,
|
'data': report,
|
||||||
}), False)
|
}))
|
||||||
time.sleep(5.0)
|
|
||||||
|
|
||||||
def _Uptime(self):
|
def _Uptime(self):
|
||||||
with open('/proc/uptime', 'r') as fh:
|
with open('/proc/uptime', 'r') as fh:
|
||||||
@@ -128,6 +131,7 @@ class Client(threadedclient.WebSocketClient):
|
|||||||
fetch.Fetch(data['timestamp'])
|
fetch.Fetch(data['timestamp'])
|
||||||
self._UpdateGrub()
|
self._UpdateGrub()
|
||||||
|
|
||||||
|
self._SendReport()
|
||||||
subprocess.check_call(['reboot'])
|
subprocess.check_call(['reboot'])
|
||||||
|
|
||||||
def received_message(self, msg):
|
def received_message(self, msg):
|
||||||
|
|||||||
Reference in New Issue
Block a user