Paul Stewart | 23cfe94 | 2010-09-29 16:32:31 -0700 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
Julius Werner | a825d25 | 2012-12-17 16:22:06 -0800 | [diff] [blame] | 3 | """Tell system to suspend, and resume some number of seconds later.""" |
Paul Stewart | 23cfe94 | 2010-09-29 16:32:31 -0700 | [diff] [blame] | 4 | |
| 5 | import os, re, subprocess, sys |
| 6 | import rtc, sys_power |
| 7 | |
| 8 | time_to_sleep = 30 |
| 9 | if len(sys.argv) > 1: |
| 10 | time_to_sleep = int(sys.argv[1]) |
| 11 | |
| 12 | if len(sys.argv) > 2: |
| 13 | after_command = ' '.join(sys.argv[2:]) |
| 14 | else: |
| 15 | after_command = None |
| 16 | |
Julius Werner | a825d25 | 2012-12-17 16:22:06 -0800 | [diff] [blame] | 17 | sys_power.do_suspend(time_to_sleep) |
Paul Stewart | 23cfe94 | 2010-09-29 16:32:31 -0700 | [diff] [blame] | 18 | |
| 19 | if after_command: |
| 20 | os.system(after_command) |