Commit Graph

3071 Commits

Author SHA1 Message Date
William Hubbs
f32d8e1bfe supervise-daemon: clarify a log message 2017-10-26 17:01:17 -05:00
William Hubbs
d019f34a83 supervise-daemon: log the command line we run to spawn the child process 2017-10-26 13:57:04 -05:00
William Hubbs
bb9c481f02 supervise-daemon: log with the service name instead of "supervise-daemon" 2017-10-26 13:36:41 -05:00
William Hubbs
82da844b42 implement "unsupervised" status
The unsupervised status is to be used when a supervisor of a supervised
service dies but leaves the service daemon itself running.
2017-10-26 13:11:12 -05:00
William Hubbs
667a09983c supervise-daemon: remove child_pid from saved options during shutdown
This allows us to detect when the supervisor dies unexpectedly because
in that case child_pid will still exist.
2017-10-26 12:58:59 -05:00
William Hubbs
cf429ee359 rc_service_value_set: remove the option if NULL is the value
This allows the equivalent of "unsetting" a value for a service.
2017-10-26 12:54:37 -05:00
William Hubbs
6f3e2e2d7d supervise-daemon.sh: fix status function with no namespaces 2017-10-25 21:20:15 -05:00
Patrick McLean
35b88fb42b cgroups_cleanup: clean up shutdown signaling
- do not sleep for the full 90 seconds if processes are dead
- re-arrange the order of signals we attempt to send to the processes
2017-10-25 21:19:15 -05:00
William Hubbs
a428c325a9 add "unsupervised" status and return code 64 to supervise-daemon status function
This is to be used if the service is being supervised and the
supervisor is somehow killed.

Currently, this is very linux specific, but I will expand to other
platforms, patches are welcome.
2017-10-25 15:09:42 -05:00
William Hubbs
3219ecd608 supervise-daemon: fix build issue for >=glibc-2.26
X-Gentoo-Bug: 635334
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=635334
2017-10-24 16:47:53 -05:00
William Hubbs
0d8dc4f798 version 0.35 2017-10-24 16:46:52 -05:00
William Hubbs
f3c70bf5b5 Update ChangeLog 2017-10-24 10:42:11 -05:00
William Hubbs
f5acc66db7 rc_find_pids: ignore pids that are not in our pid namespace
X-Gentoo-Bug: 634634
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=634634
2017-10-24 10:37:37 -05:00
William Hubbs
fdce4769f2 supervise-daemon: multiple fixes
- Harden against dying by handling all signals that would terminate the
program and adding --reexec support
- factor the supervisor into its own function
- fix test for whether we are already running
2017-10-24 10:26:18 -05:00
William Hubbs
35b1996704 supervise-daemon: elevate some log messages to warnings
Prior to this change, we were logging unexpected terminations of daemons
we were supervising at the info level. This change moves the logs to
warnings.
2017-10-18 18:07:50 -05:00
William Hubbs
3c8e7ed255 version 0.34 2017-10-13 16:10:57 -05:00
William Hubbs
acaed1f910 Update ChangeLog 2017-10-13 11:29:49 -05:00
William Hubbs
91109e31d8 update news 2017-10-12 18:54:17 -05:00
William Hubbs
2b6eeea01d man: remove service(8) man page 2017-10-12 18:47:36 -05:00
William Hubbs
a15de23e57 typo fix 2017-10-10 10:56:27 -05:00
William Hubbs
efa9ba485d init.d/sysfs.in: fix reference to RC_LIBEXECDIR
The sysfs init script referred to @LIBEXECDIR@ before this change, but
it is better to refer to RC_LIBEXECDIR so that we get rid of a sed
substitution.
2017-10-09 15:54:06 -05:00
Chris Cromer
d4ddd72701 add option to make agetty startup quiet
This fixes #150
2017-10-06 14:43:59 -05:00
William Hubbs
1e9af2cd42 fix compiler warning 2017-10-05 18:31:07 -05:00
William Hubbs
3c05db74f6 remove service binary
The service binary was just a synonym for rc-service, so use rc-service
instead of service. If you want a "service" binary, it should be
something that can determine which service manager you are running and
run the appropriate service manager commands.
2017-10-02 18:09:09 -05:00
William Hubbs
edc54b0377 version 0.33 2017-10-02 16:58:59 -05:00
William Hubbs
8e53a3fa8a Update ChangeLog 2017-10-02 11:21:29 -05:00
William Hubbs
7f3b413111 use printf consistently in cgroups handling
This makes the cgroups handling consistent between cgroups v1 and v2.
Also, it fixes #167.
2017-09-29 12:51:12 -05:00
William Hubbs
1ccba05658 sh/rc-functions.sh: add need_if_exists convenience function 2017-09-22 17:22:50 -05:00
William Hubbs
c46adf1434 man/openrc-run.8: Clarify the explanation of the need dependency 2017-09-22 16:24:20 -05:00
William Hubbs
1cac8b080c ignore sigchld when shutting down the supervised process
We need to do this to skip the zombie state for the child process since
we are not easily able to wait() for it.
2017-09-18 16:59:18 -05:00
William Hubbs
b58194ef63 typo fix 2017-09-18 13:30:56 -05:00
William Hubbs
b28c0d6f66 typo fix 2017-09-18 13:03:34 -05:00
William Hubbs
3cf19b0f30 supervise-daemon: code cleanup
Clean up the process for killing an active supervisor when stopping.
2017-09-18 12:25:37 -05:00
William Hubbs
0eb47b9af3 initialize the stop schedule 2017-09-18 10:36:17 -05:00
William Hubbs
4ab60ff109 rc-schedules.c: pass the correct pid to rc_find_pids
This is for #163.
2017-09-17 14:20:05 -05:00
Jason Zaman
db4a578273 selinux: fix const qualifier warning
rc-selinux.c: In function ‘selinux_setup’:
rc-selinux.c:361:9: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  curr_t = context_type_get(curr_con);
         ^
2017-09-17 11:41:24 -05:00
Jason Zaman
b1c3422f45 selinux: use openrc contexts path to get contexts
The minimum requirement for libselinux is now >=2.6
The refpolicy and the gentoo policy contain the
contexts since version 2.20170204-r4
2017-09-17 11:40:07 -05:00
William Hubbs
3fafd7a76e sysfs: fix cgroup hybrid mode
In hybrid mode, we should not try to mount cgroup2 if it is not
available in the kernel.

This fixes #164.
2017-09-16 17:02:52 -05:00
William Hubbs
cd5722aca5 cgroup2_find_path: use legacy mode if cgroup2 is not in the kernel
This is related to #164.
2017-09-16 16:49:22 -05:00
William Hubbs
dcb4a4d261 version 0.32 2017-09-16 13:24:52 -05:00
William Hubbs
e312e56997 Update ChangeLog 2017-09-15 15:33:24 -05:00
William Hubbs
2f60a959b4 update news file 2017-09-15 14:25:33 -05:00
William Hubbs
25b45a5a23 cgroup_cleanup: try to remove the cgroup version 2 cgroup
If we were able to kill all the processes in the cgroup, it should be
removed.
2017-09-15 14:22:34 -05:00
William Hubbs
4651b8c7e9 rc-cgroup.sh: cgroup_cleanup fix error handling
cgroup_cleanup should warn if it is unable to clean up all processes in
the control group, but it will always return success.
2017-09-15 13:42:50 -05:00
William Hubbs
50608b54ed rc-cgroup.sh: fix signal names
The "SIG" prefix on signal names passed to kill -s isn't portable.
2017-09-15 13:28:15 -05:00
William Hubbs
b0a077a35f add quiet switch to do_stop in src-schedules.c
This allows supervise-daemon to run this code without attempting to
print some status messages used by start-stop-daemon.
2017-09-14 18:24:39 -05:00
William Hubbs
6a5ca2ab36 make the procedure for killing child processes of services configurable 2017-09-14 16:17:20 -05:00
William Hubbs
2b0345165e Make cgroup_cleanup send only one sigterm and sigkill
Instead of looping and sending multiple signals to child processes in
cgroup_cleanup, we send sigterm followed by sleeping one second then
sigkill.

This brings us more in line with systemd's "control group" killmode
setting.

Also, this commit includes several shellcheck cleanups.
2017-09-14 10:55:06 -05:00
William Hubbs
8885580986 rc-cgroup.sh: move cgroup_cleanup to the end of the file 2017-09-14 10:44:52 -05:00
William Hubbs
6d7713a758 guide.md: clarify cgroups documentation
Update the documentation to reflect cgroups version 2 support.
Also, add a section on dealing with orphaned service processes.

This fixes #94.
2017-09-14 10:39:38 -05:00