Compare commits

...

7 Commits

Author SHA1 Message Date
William Hubbs
ac76b24b85 Update ChangeLog 2018-12-06 17:40:06 -06:00
William Hubbs
b8e57c693a init.d/agetty: set default respawn period to 60 seconds
Without a respawn period setting, the supervisor will give up on
respawning agetty after it is respawned respawn_max times. For most
daemons giving up like this is reasonable, but not for agettys. Agettys
should always be respawned unless they are respawning too fafst,.

If an agetty is respawning faster than 10 times in 60 seconds, this
seems to be too fast.
2018-12-06 16:56:20 -06:00
William Hubbs
5df12e2414 supervise-daemon: fix busy loop
This fixes #264.
2018-12-06 16:56:20 -06:00
William Hubbs
461df0c78b version 0.40.2 2018-12-06 16:55:51 -06:00
William Hubbs
cefae65392 Update ChangeLog 2018-12-04 17:27:46 -06:00
Alexander Zubkov
69fbd12993 supervise-daemon: redirect std{in,out,err} to /dev/null after demonizing
This fixes #239.
2018-12-04 17:23:27 -06:00
William Hubbs
4aa5686d90 version 0.40.1 2018-12-04 17:21:55 -06:00
4 changed files with 78 additions and 27 deletions

View File

@@ -1,3 +1,57 @@
commit b8e57c693a973528799c9a5fdf86135b658dcce2
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
init.d/agetty: set default respawn period to 60 seconds
Without a respawn period setting, the supervisor will give up on
respawning agetty after it is respawned respawn_max times. For most
daemons giving up like this is reasonable, but not for agettys. Agettys
should always be respawned unless they are respawning too fafst,.
If an agetty is respawning faster than 10 times in 60 seconds, this
seems to be too fast.
commit 5df12e24146cd091de71c77737c07eed5a14101f
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
supervise-daemon: fix busy loop
This fixes #264.
commit 461df0c78b1b8a58bb272958dce4af39fc2549c0
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.40.2
commit cefae65392568afac83f64773b6ad33462791c38
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Update ChangeLog
commit 69fbd129938522cdd9b82fea2b83c857796a32af
Author: Alexander Zubkov <green@msu.ru>
Commit: William Hubbs <w.d.hubbs@gmail.com>
supervise-daemon: redirect std{in,out,err} to /dev/null after demonizing
This fixes #239.
commit 4aa5686d9037132b27d7554436738fa98e8e9057
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.40.1
commit ab6c8d56f155564f56d61553c4b1af9e7f63a9d2
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Update ChangeLog
commit fb4dd351c7ef2614076309d630e163ff963ac8bf
Author: Austin English <austinenglish@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
@@ -1389,22 +1443,3 @@ Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Add zsh-completion support
commit d220fc272337b216bff6ac781a7b6be4e6f3caee
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
add bash completion support
This fixes #188.
commit a2447dfb420cbd97a65cc085404c031d42cb3dfb
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
rc-service: add --ifcrashed option
This works like the other --if options. If the service is crashed, run
the command.
This fixes #154.

View File

@@ -1,3 +1,3 @@
NAME= openrc
VERSION= 0.40
VERSION= 0.40.2
PKG= ${NAME}-${VERSION}

View File

@@ -12,6 +12,7 @@
description="start agetty on a terminal line"
supervisor=supervise-daemon
port="${RC_SVCNAME#*.}"
respawn_period="${respawn_period:-60}"
term_type="${term_type:-linux}"
command=/sbin/agetty
command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}"

View File

@@ -184,13 +184,22 @@ static void re_exec_supervisor(void)
static void handle_signal(int sig)
{
int serrno = errno;
pid_t pid;
switch (sig) {
case SIGALRM:
do_healthcheck = 1;
break;
case SIGCHLD:
while (waitpid((pid_t)(-1), NULL, WNOHANG) > 0) {}
if (exiting)
while (waitpid((pid_t)(-1), NULL, WNOHANG) > 0) {}
else {
while ((pid = waitpid((pid_t)(-1), NULL, WNOHANG|WNOWAIT)) > 0) {
if (pid == child_pid)
break;
pid = waitpid(pid, NULL, WNOHANG);
}
}
break;
case SIGTERM:
exiting = 1;
@@ -451,6 +460,7 @@ static void supervisor(char *exec, char **argv)
int healthcheck_respawn;
int i;
int nkilled;
int ready;
int sig_send;
pid_t health_pid;
pid_t wait_pid;
@@ -498,18 +508,18 @@ static void supervisor(char *exec, char **argv)
alarm(healthcheckdelay);
else if (healthchecktimer)
alarm(healthchecktimer);
fifo_fd = open(fifopath, O_RDONLY |O_NONBLOCK);
failing = 0;
while (!exiting) {
healthcheck_respawn = 0;
wait_pid = waitpid(child_pid, &i, WNOHANG);
memset(buf, 0, sizeof(buf));
if (fifo_fd >= 0) {
fifo_fd = open(fifopath, O_RDONLY);
if (fifo_fd > 0) {
memset(buf, 0, sizeof(buf));
count = read(fifo_fd, buf, sizeof(buf) - 1);
close(fifo_fd);
if (count != -1)
buf[count] = 0;
}
if (strlen(buf) > 0) {
if (count == 0)
continue;
syslog(LOG_DEBUG, "Received %s from fifo", buf);
if (strncasecmp(buf, "sig", 3) == 0) {
if ((sscanf(buf, "%s %d", cmd, &sig_send) == 2)
@@ -521,6 +531,7 @@ static void supervisor(char *exec, char **argv)
sig_send, child_pid);
}
}
continue;
}
if (do_healthcheck) {
do_healthcheck = 0;
@@ -553,6 +564,7 @@ static void supervisor(char *exec, char **argv)
syslog(LOG_INFO, "killed %d processes", nkilled);
continue;
}
wait_pid = waitpid(child_pid, &i, WNOHANG);
if (wait_pid == child_pid) {
if (WIFEXITED(i))
syslog(LOG_WARNING, "%s, pid %d, exited with return code %d",
@@ -982,6 +994,9 @@ int main(int argc, char **argv)
tty_fd = open("/dev/tty", O_RDWR);
#endif
devnull_fd = open("/dev/null", O_RDWR);
dup2(devnull_fd, STDIN_FILENO);
dup2(devnull_fd, STDOUT_FILENO);
dup2(devnull_fd, STDERR_FILENO);
child_pid = fork();
if (child_pid == -1)
eerrorx("%s: fork: %s", applet, strerror(errno));