mirror of
https://github.com/troglobit/finit.git
synced 2026-11-20 19:41:51 +00:00
pidfile: monitor renamed files, e.g. rsyslogd.pid.tmp
Signed-off-by: Robert Andersson <robert.m.andersson@se.atlascopco.com>
This commit is contained in:
1 parent
b64dbbf8d0
commit
76fc72770e
1 file changed
+3
-2
+3
-2
@@ -64,7 +64,7 @@ static void pidfile_callback(void *arg, int fd, int events)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
mkcond(cond, sizeof(cond), svc->cmd);
|
mkcond(cond, sizeof(cond), svc->cmd);
|
||||||
if (ev->mask & (IN_CREATE | IN_ATTRIB | IN_MODIFY)) {
|
if (ev->mask & (IN_CREATE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO)) {
|
||||||
svc_started(svc);
|
svc_started(svc);
|
||||||
cond_set(cond);
|
cond_set(cond);
|
||||||
} else if (ev->mask & IN_DELETE)
|
} else if (ev->mask & IN_DELETE)
|
||||||
@@ -111,6 +111,7 @@ static void pidfile_init(void *arg)
|
|||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
struct context *ctx = arg;
|
struct context *ctx = arg;
|
||||||
|
uint32_t mask = IN_CREATE | IN_ATTRIB | IN_DELETE | IN_MODIFY | IN_MOVED_TO;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The bootmisc plugin is responsible for setting up /var/run.
|
* The bootmisc plugin is responsible for setting up /var/run.
|
||||||
@@ -123,7 +124,7 @@ static void pidfile_init(void *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->wd = inotify_add_watch(ctx->fd, path, IN_CREATE | IN_ATTRIB | IN_DELETE | IN_MODIFY);
|
ctx->wd = inotify_add_watch(ctx->fd, path, mask);
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
if (ctx->wd < 0) {
|
if (ctx->wd < 0) {
|
||||||
|
|||||||
Reference in new issue
Block a user