mirror of
https://github.com/troglobit/finit.git
synced 2026-10-06 15:50:12 +07:00
Fix #212: service PID file lost after initctl reload
Clearing of the svc->pidfile was introduced in e1b87d70 for a
restriction that has now been removed.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+3
-1
@@ -84,8 +84,10 @@ static void pidfile_update_conds(char *dir, char *name, uint32_t mask)
|
||||
mkcond(svc, cond, sizeof(cond));
|
||||
if (mask & (IN_CLOSE_WRITE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO)) {
|
||||
svc_started(svc);
|
||||
if (!svc_has_pidfile(svc))
|
||||
if (!svc_has_pidfile(svc)) {
|
||||
_d("Setting %s PID file to %s", svc->name, fn);
|
||||
pid_file_set(svc, fn, 1);
|
||||
}
|
||||
|
||||
if (svc_is_forking(svc)) {
|
||||
pid_t pid;
|
||||
|
||||
+8
-1
@@ -717,6 +717,7 @@ static int show_status(char *arg)
|
||||
while (arg && arg[0]) {
|
||||
long now = jiffies();
|
||||
char uptm[42] = "N/A";
|
||||
char *pidfn = NULL;
|
||||
int exact = 0;
|
||||
|
||||
for (svc = client_svc_iterator(1); svc; svc = client_svc_iterator(0)) {
|
||||
@@ -737,6 +738,12 @@ static int show_status(char *arg)
|
||||
if (quiet)
|
||||
return svc->state != SVC_RUNNING_STATE;
|
||||
|
||||
pidfn = svc->pidfile;
|
||||
if (pidfn[0] == '!')
|
||||
pidfn++;
|
||||
else if (pidfn[0] == 0)
|
||||
pidfn = "none";
|
||||
|
||||
printf(" Status : %s\n", status(svc, 1));
|
||||
printf(" Identity : %s\n", svc_ident(svc, ident, sizeof(ident)));
|
||||
printf("Description : %s\n", svc->desc);
|
||||
@@ -744,7 +751,7 @@ static int show_status(char *arg)
|
||||
printf("Environment : %s\n", svc_environ(svc, buf, sizeof(buf)));
|
||||
printf("Condition(s): %s\n", svc_cond(svc, buf, sizeof(buf)));
|
||||
printf(" Command : %s\n", svc_command(svc, buf, sizeof(buf)));
|
||||
printf(" PID file : %s\n", svc->pidfile);
|
||||
printf(" PID file : %s\n", pidfn);
|
||||
printf(" PID : %d\n", svc->pid);
|
||||
printf(" User : %s\n", svc->username);
|
||||
printf(" Group : %s\n", svc->group);
|
||||
|
||||
@@ -1310,8 +1310,6 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
|
||||
svc_unblock(svc);
|
||||
}
|
||||
|
||||
/* Always clear svc PID file, for now. See TODO */
|
||||
svc->pidfile[0] = 0;
|
||||
/* Decode any optional pid:/optional/path/to/file.pid */
|
||||
if (pid && svc_is_daemon(svc) && pid_file_parse(svc, pid))
|
||||
_e("Invalid 'pid' argument to service: %s", pid);
|
||||
|
||||
Reference in New Issue
Block a user