On Sun, 19 May 2019 11:41:47 +0800 zhenwei pi <pizhenwei@xxxxxxxxxxxxx> wrote: > Specify the pid file by command argument -p/--pid-file, tgtd can > write pid in pid file after running into daemon, and remove the > file before exiting. > The pid file's life cycle should be as the same as the tgtd, so we > can only remove it before tgtd exiting. The pid file may still remains > after tgtd crashing due to a bug, but it's does not matter. The logic > of monitor agent may be like this: > static int tgtd_pid; > > int pid = get_pid_from_pidfile(path); > if (!is_running(pid) || (tgdt_pid != pid)) { > do_something(); > } > > Signed-off-by: zhenwei pi <pizhenwei@xxxxxxxxxxxxx> > Acked-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxx> > --- > usr/tgtd.c | 40 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 39 insertions(+), 1 deletion(-) applied, thanks.