Skip to content

Commit

Permalink
forcing sudo reboot. References #10
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerShubi committed Oct 10, 2019
1 parent 3e0092e commit 4f6a0b0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CameraNetwork/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1353,4 +1353,5 @@ def handle_reboot(self):
logging.info("Performing reboot")
logging.shutdown()

os.system('sudo reboot')
# TODO Long term fix
os.system('sync; sudo reboot -f') # Changed from 'sudo reboot', workaround for reboot hanging
16 changes: 10 additions & 6 deletions scripts/start_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
## OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.##
"""
This script statrts the camera activity.
Should be run at startup of the raspberry Pi.
This script starts the camera activity.
Should be run at startup of the raspberry Pi / Odroid XU4.
"""

import argparse
Expand Down Expand Up @@ -138,7 +138,8 @@ def main():
logging.exception('Failed starting the camera. Rebooting.')
logging.shutdown()
time.sleep(120)
os.system('sudo reboot')
# TODO Long term fix
os.system('sync; sudo reboot -f') # Changed from 'sudo reboot', workaround for reboot hanging
except Exception as e:
#
# Failed starting the camera, might be some USB problem.
Expand All @@ -149,7 +150,8 @@ def main():
logging.exception('Rebooting. Unkown error:\n{}'.format(repr(e)))
logging.shutdown()
time.sleep(120)
os.system('sudo reboot')
# TODO Long term fix
os.system('sync; sudo reboot -f') # Changed from 'sudo reboot', workaround for reboot hanging


if __name__ == '__main__':
Expand Down Expand Up @@ -178,7 +180,8 @@ def main():
logging.exception('Failed starting the camera. Rebooting.')
logging.shutdown()
time.sleep(120)
os.system('sudo reboot')
# TODO Long term fix
os.system('sync; sudo reboot -f') # Changed from 'sudo reboot', workaround for reboot hanging
except Exception as e:
#
# Failed starting the camera, might be some USB problem.
Expand All @@ -189,4 +192,5 @@ def main():
logging.exception('Rebooting. Unkown error:\n{}'.format(repr(e)))
logging.shutdown()
time.sleep(120)
os.system('sudo reboot')
# TODO Long term fix
os.system('sync; sudo reboot -f') # Changed from 'sudo reboot', workaround for reboot hanging
8 changes: 5 additions & 3 deletions scripts/start_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def main():
help='Skip starting the default tunnel')
parser.add_argument(
'--log_level',
default='INFO',
default='DEBUG',
help='Set the log level (possible values: info, debug, ...)')
args = parser.parse_args()

Expand Down Expand Up @@ -109,7 +109,8 @@ def main():

if failures_cnt > camera_settings[gs.INTERNET_FAILURE_THRESH]:
logging.error('Failed to connect 3G modem. Will reboot...')
os.system('sudo reboot')
# TODO Long term fix
os.system('sync; sudo reboot -f') # Changed from 'sudo reboot', workaround for reboot hanging

logging.error(
'Failed to retrieve proxy parameters. will sleep and try again later.')
Expand Down Expand Up @@ -148,7 +149,8 @@ def main():
logging.debug('Internet watchdog: failure number: %d.' % failures_cnt)
if failures_cnt > camera_settings[gs.INTERNET_FAILURE_THRESH]:
logging.error('Failed to connect 3G modem. Will reboot...')
os.system('sudo reboot')
# TODO Long term fix
os.system('sync; sudo reboot -f') # Changed from 'sudo reboot', workaround for reboot hanging
else:
logging.debug('Internet watchdog: succeed.')
failures_cnt = 0
Expand Down

0 comments on commit 4f6a0b0

Please sign in to comment.