def start_watchdog(): # check here for watchdog exist watchdog_pid = get_watchdog_pid() if not watchdog_pid: # setsid <prog> & daemonizes... cmd = 'setsid %s/safplus_watchdog.py &' % asp.get_asp_etc_dir() os.system(cmd) else: asp.fail_and_exit('SAFplus is already running on node [%s], pid [%s]' % (asp.get_asp_node_addr(), watchdog_pid), False)
def watchdog_driver(cmd): cmd_map = {'start' : start_watchdog, 'stop' : stop_watchdog, 'restart' : restart_asp, 'status' : saf_status, 'help' : watchdog_usage } if cmd_map.has_key(cmd): #create_watchdog_cmd_marker(cmd) # for printing the executing line and for displaying err cmd_map[cmd]() else: asp.fail_and_exit('Command [%s] not found !!' % cmd)