Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: scripts/slave/recipe_modules/chromium_android/resources/shutdown_device_temp_monitor.py

Issue 1308173006: Create daemon to monitor android device temperatures (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 """
4 Shutdown the device_temp_monitor process launched
5 by spawn_device_temp_monitor.py by reading its pid in the file pid_file_path.
6 """
7
8 import logging
9 import os
10 import signal
11 import sys
12
13 def main(pid_file_path='/tmp/device_monitor_pid'):
luqui 2015/09/03 01:10:41 pidfiles usually end in .pid, rather than _pid.
jbudorick 2015/09/03 17:37:31 I'd use argparse for command-line arguments to a s
14
15 try:
16 with open(pid_file_path) as pid_file:
17 monitor_pid = int(pid_file.readline())
18
19 logging.info('Sending SIGTERM to %d', monitor_pid)
20 os.kill(monitor_pid, signal.SIGTERM)
21 os.remove(pid_file_path)
luqui 2015/09/03 01:10:41 I think it should clean up its own pidfile with a
22
23 except (IOError, OSError):
24 logging.exception('Error terminating device monitor')
25
26 if __name__ == '__main__':
27 sys.exit(main(*sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698