def stop_amf(): stopFile = SAFPLUS_RUN_DIR + '/' + SAFPLUS_STOP_FILE touch(stopFile) # create 'safplus_stop' file to indicate graceful shutdown of SAFplus_AMF def wait_for_safplus_shutdown(): t = SAFPLUS_SHUTDOWN_WAIT_TIMEOUT for i in range(t/6): amf_pid = get_amf_pid() if amf_pid == 0: break time.sleep(6) print ".", sys.stdout.flush() print "" amf_pid = get_amf_pid() if amf_pid == 0: log.warning('SAFplus is not running on node [%s]. Cleaning up anyway...' % get_safplus_node_addr()) kill_amf() run_custom_scripts('stop') else: log.info('Stopping SAFplus AMF...') os.kill(amf_pid, signal.SIGINT) log.debug('SAFplus is running with pid: %d' % amf_pid) log.info('Waiting for SAFplus AMF to shutdown...') wait_for_safplus_shutdown() amf_pid = get_amf_pid() if amf_pid: kill_amf() run_custom_scripts('stop') if not is_simulation(): safplus_tipc.unload_tipc_module()
def stop_amf(): stopFile = SAFPLUS_RUN_DIR + '/' + SAFPLUS_STOP_FILE touch(stopFile) # create 'safplus_stop' file to indicate graceful shutdown of SAFplus_AMF def wait_for_safplus_shutdown(): t = SAFPLUS_SHUTDOWN_WAIT_TIMEOUT for i in range(t/6): amf_pid = get_amf_pid() if amf_pid == 0: break time.sleep(6) print ".", sys.stdout.flush() print "" amf_pid = get_amf_pid() if amf_pid == 0: log.warning('SAFplus is not running on node [%s]. Cleaning up anyway...' % get_safplus_node_addr()) kill_amf() run_custom_scripts('stop') else: log.info('Stopping SAFplus AMF...') os.kill(amf_pid, signal.SIGINT) log.debug('SAFplus is running with pid: %d' % amf_pid) log.info('Waiting for SAFplus AMF to shutdown...') wait_for_safplus_shutdown() #amf_pid = get_amf_pid() #if amf_pid: kill_amf() #kill all process onme more time to make sure all processes are stopped kill_amf() run_custom_scripts('stop') if not is_simulation(): safplus_tipc.unload_tipc_module()
def zap_amf(): stopFile = SAFPLUS_RUN_DIR + '/' + SAFPLUS_STOP_FILE touch(stopFile) # create 'safplus_stop' file to indicate gracefull shutdown of SAFplus_AMF run_custom_scripts('zap') kill_amf() if not is_simulation(): safplus_tipc.unload_tipc_module()
def start_watchdog(): global TipcSettings # check whether watchdog exist watchdog_pid = get_watchdog_pid() if not watchdog_pid: if TipcSettings=='enforce': safplus_tipc.unload_tipc_module() if TipcSettings!='ignore': safplus_tipc.load_config_tipc_module() set_ld_library_paths() # setsid <prog> & daemonizes... cmd = 'setsid %s/safplus_watchdog.py &' % safplus.SAFPLUS_ETC_DIR os.system(cmd) else: safplus.fail_and_exit('SAFplus is already running on node [%s], pid [%s]' % (safplus.get_safplus_node_addr(), watchdog_pid))
def start_watchdog(): global TipcSettings # check whether watchdog exist watchdog_pid = get_watchdog_pid() if not watchdog_pid: if TipcSettings == 'enforce': safplus_tipc.unload_tipc_module() if TipcSettings != 'ignore': safplus_tipc.load_config_tipc_module() set_ld_library_paths() # setsid <prog> & daemonizes... cmd = 'setsid %s/safplus_watchdog.py &' % safplus.SAFPLUS_ETC_DIR os.system(cmd) else: safplus.fail_and_exit( 'SAFplus is already running on node [%s], pid [%s]' % (safplus.get_safplus_node_addr(), watchdog_pid))
def start_watchdog(): global tipc_settings # check whether watchdog exist watchdog_pid = get_watchdog_pid() if not watchdog_pid: if safplus_tipc.has_tipc_plugin() and (safplus_tipc.ignore_tipc_settings() == False): if safplus_tipc.enforce_tipc_settings() == True: safplus_tipc.unload_tipc_module() safplus_tipc.load_config_tipc_module() set_ld_library_paths() codeBootFile = safplus.SAFPLUS_RUN_DIR + '/' + safplus.SAFPLUS_CODEBOOT_FILE safplus.touch(codeBootFile) # create 'safplus_codeboot' file to indicate start-up of SAFplus_AMF # setsid <prog> & daemonizes... cmd = 'setsid %s/safplus_watchdog.py &' % safplus.SAFPLUS_ETC_DIR os.system(cmd) else: safplus.fail_and_exit('SAFplus is already running on node [%s], pid [%s]' % (safplus.get_safplus_node_addr(), watchdog_pid))
def start_watchdog(): global tipc_settings # check whether watchdog exist watchdog_pid,sandbox = get_watchdog_pid() if not watchdog_pid: if safplus_tipc.has_tipc_plugin() and (safplus_tipc.ignore_tipc_settings() == False): if safplus_tipc.enforce_tipc_settings() == True: safplus_tipc.unload_tipc_module() safplus_tipc.load_config_tipc_module() set_ld_library_paths() codeBootFile = safplus.SAFPLUS_RUN_DIR + '/' + safplus.SAFPLUS_CODEBOOT_FILE safplus.touch(codeBootFile) # create 'safplus_codeboot' file to indicate start-up of SAFplus_AMF # setsid <prog> & daemonizes... cmd = 'setsid %s/safplus_watchdog.py &' % safplus.SAFPLUS_ETC_DIR os.system(cmd) else: #safplus.fail_and_exit('SAFplus is already running on node [%s], pid [%s]' % (safplus.get_safplus_node_addr(), watchdog_pid)) safplus.fail_and_exit('SAFplus is already running from sandbox [%s]' % sandbox)