def watch_pid(config, key, pid): lock = config['daemon']['lock'] if not is_daemon_running(lock): sys.exit("ERROR: Daemon not running") if not DaemonIPC.is_pid_alive(pid): sys.exit("ERROR: pid [%i] does not exist" % pid) client = get_daemon_connection(config) client.post_watch_pid(key, pid) client.close()
def is_daemon_running(lock): return DaemonIPC.is_pid_alive(DaemonIPC.get_pid_from_lock(lock))