Add the following variables to expose more arguments that can be passed
to start-stop-daemon or supervise-daemon:
- directory will be passed to --chdir
- error_log will be passed to --stderr
- output_log will be passed to --stdout
- umask will be passed to umask
This is for #184.
Add the ability to force-kill a service if it does not go down
successfully. Also, adjust the default wait time for an s6 service to go
down to 60 seconds.
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.
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.
The --retry option for supervise-daemon defines how the supervisor will
attempt to stop the child process it is monitoring. It is defined when
the supervisor is started since stopping the supervisor just sends a
signal to the active supervisor.
This fixes#160.
This creates --respawn-delay, --respawn-max and --respawn-period. It was
suggested that it would be easier to follow if the options were
separated.
This is for #126.
Allow limiting the number of times supervise-daemon will attempt to respawn a
daemon once it has died to prevent infinite respawning. Also, set a
reasonable default limit (10 times in a 5 second period).
This is for issue #126.
We do not need to care about the path on the shebang line of a service
script as long as the shebang line ends with "openrc-run".
This fixes#119 and #120.
Supervisor setups break easily when start/stop/status functions are not
default.
Applications that write multiple PIDs to a pidfile (eg HAProxy as
described in bug 601540), can also benefit from being able to call the
default start/stop/status with modified environment variables.
Expose the default start/stop/status functions as
default_start/stop/status, and use them for the defaults
start/stop/status.
Trivial usage example:
```
stop()
{
t=$(mktemp)
for pid in $(cat $pidfile) ; do
echo $pid >$t
pidfile=$t default_stop
done
rm -f $t
}
```
X-Gentoo-Bug: 601540
X-Gentoo-Bug-URL: https://bugs.gentoo.org/601540
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This allows us to avoid the warnings from bash-4.4 about null bytes in
command substitutions.
If you have separate /usr, are not using an initramfs, and have a file
called /proc/self/environ on your root file system, this will break.
X-Gentoo-Bug: 594534
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=594534
btrfs support is not implemented yet (for q Q v), but at least tmpfiles.sh
no longer chokes about tmpfiles.d lines of recent systemd versions
This fixes#87.
The read builtin in most shells will interpret backslash characters
as escapes, and they are lost when reading binfmt files line-by-line.
This causes magic strings containing backslashes to be mangled and
become invalid, resulting in erroneous 'invalid entry' messages.
The -r option to read disables special handling of backslashes and
keeps all lines intact.
X-Gentoo-Bug: 575114
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=575114
The s6-svc syntax changed for wait-up, wait-ready, wait-down, and
wait-finished. This changes the s6 handling script to use the current
valid syntax.
This fixes#65.
In the past, OpenRC was a hybrid of a centralized and file-scope
license/copyright structure.
I followed the instructions from the Software Freedom Law Center [1] to
convert to a Centralized structure where possible, for easier future
maintenance.
[1] https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html
- gendepends.sh needs to read this directory to allow dependencies to be
overridden
- init.sh for Linux and Bsd need to read it to allow config settings
they use to be overridden.