def system_shutdown(): if not check_admin(request_user): return jsonify(build_error(ERROR_NOT_AUTHORIZED, "Insufficient privileges for request.")), UNAUTHORIZED sh.shutdown() return jsonify(), ACCEPTED
def shutdown_pi(): global led_thread_run global emergency_led_run log("Shutting down...") led_thread_run = False emergency_led_run = False sleep(0.5) shutdown("now")
def system_shutdown(): if not check_admin(request_user): return jsonify( build_error(ERROR_NOT_AUTHORIZED, "Insufficient privileges for request.")), UNAUTHORIZED sh.shutdown() return jsonify(), ACCEPTED
def main(args): """main entry point for worker. :param args: """ JOB_ID = os.environ.get('JOB_ID') if JOB_ID is None: raise Exception('EC2 started without Job ID - exiting now.') if args.process_job: try: print('Received job ID, starting job.') sys.stdout.flush() process_job_on_worker(JOB_ID) except Exception as excpn: email.send_infra_failure_email(str(excpn), job_id=JOB_ID) finally: print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') print('SHUTDOWN SOON!') print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') sys.stdout.flush() time.sleep(120) elif args.chk_efs: try: print('Checking EFS...') fs_utils.chk_efs() except IOError as ioerror: email.send_infra_failure_email(str(ioerror), job_id=JOB_ID) print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') print('SHUTDOWN SOON!') print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') sys.stdout.flush() time.sleep(120) sh.shutdown('-h', 'now')
def reboot(): signals.reboot.send(sender='solarsan') signals.shutdown.send(sender='solarsan') logger.warning("Rebooting system in %ds..", SHUTDOWN_WAIT) time.sleep(SHUTDOWN_WAIT) return sh.shutdown('-r', 'now')
def shutdown(): signals.shutdown.send(sender='solarsan') logger.warning("Shutting system down in %ds..", SHUTDOWN_WAIT) time.sleep(SHUTDOWN_WAIT) return sh.shutdown('-h', 'now')
def handle_touch(event): wait_blink(2.0) with sh.contrib.sudo: sh.shutdown("--poweroff", "now")
def ui_command_shutdown(self): """ shutdown - Shutdown system. """ #status.tasks.shutdown.delay() print sh.shutdown('-h', 'now')