aboutsummaryrefslogtreecommitdiff
path: root/sh
AgeCommit message (Collapse)Author
2018-03-11Clean up cgroups v2 codeWilliam Hubbs
Remove the IFS manipulation and simplify the loop that processes the settings.
2018-02-28init.sh: apply SELinux label for /run early in bootJason Zaman
Some initramfs mount /run which then ends up with the wrong labels. Force relabel all of /run right after its mounted to fix.
2018-02-28init-early.sh.Linux.in: apply the selinux label to /dev/console earlyJason Zaman
/dev/console is relabelled later in the devfs init script, but by then we have already missed some of the messages, so fix that label early.
2018-02-23check whether /sys/fs/cgroup is a mountpointChristian Brauner
The current check only tries to detect whether /sys/fs/cgroup exists and whether it is writable or not. But when the init system doesn't mount cgroups then /sys/fs/cgroup will just be an empty directory. When paired with unprivileged containers that mount sysfs this will cause misleading errors to be printed since /sys/fs/cgroup will be owned by user nobody:nogroup in this case. Independent of this specific problem this check will also be misleading when the /sys/fs/cgroup exists and is in fact writable by the init system but isn't actually a mountpoint. Note from William. "grep -qs" doesn't need to redirect output to /dev/null since it is completely silent. This fixes #209.
2017-12-01Clean up the calls to group_add_serviceWilliam Hubbs
This function should only be called once and it does not take any arguments. X-Gentoo-Bug: 639166 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=639166
2017-11-29add more variables for start-stop-daemon and supervise-daemon optionsJulien Reichardt
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.
2017-11-16s6 supervisor fixesWilliam Hubbs
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.
2017-10-27supervise-daemon: use RC_SVCNAME as the first argument to the daemonWilliam Hubbs
This makes ps show which service the supervisor is monitoring.
2017-10-26implement "unsupervised" statusWilliam Hubbs
The unsupervised status is to be used when a supervisor of a supervised service dies but leaves the service daemon itself running.
2017-10-25supervise-daemon.sh: fix status function with no namespacesWilliam Hubbs
2017-10-25cgroups_cleanup: clean up shutdown signalingPatrick McLean
- 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-25add "unsupervised" status and return code 64 to supervise-daemon status functionWilliam Hubbs
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-09-29use printf consistently in cgroups handlingWilliam Hubbs
This makes the cgroups handling consistent between cgroups v1 and v2. Also, it fixes #167.
2017-09-22sh/rc-functions.sh: add need_if_exists convenience functionWilliam Hubbs
2017-09-16cgroup2_find_path: use legacy mode if cgroup2 is not in the kernelWilliam Hubbs
This is related to #164.
2017-09-15cgroup_cleanup: try to remove the cgroup version 2 cgroupWilliam Hubbs
If we were able to kill all the processes in the cgroup, it should be removed.
2017-09-15rc-cgroup.sh: cgroup_cleanup fix error handlingWilliam Hubbs
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-15rc-cgroup.sh: fix signal namesWilliam Hubbs
The "SIG" prefix on signal names passed to kill -s isn't portable.
2017-09-14make the procedure for killing child processes of services configurableWilliam Hubbs
2017-09-14Make cgroup_cleanup send only one sigterm and sigkillWilliam Hubbs
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-14rc-cgroup.sh: move cgroup_cleanup to the end of the fileWilliam Hubbs
2017-09-14add support for control groups version 2William Hubbs
This is for #94.
2017-09-06add retry option to supervise-daemonWilliam Hubbs
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.
2017-08-15sh/openrc-run: source service script before ulimit is processedWilliam Hubbs
This is needed to allow the service script author to set a default for rc_ulimit inside the service script.
2017-05-10supervise-daemon:create multiple options from --respawn-limitWilliam Hubbs
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.
2017-05-09supervise-daemon: add a --respawn-limit optionWilliam Hubbs
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.
2017-03-23sh/gendepends.sh.in: fix detection of service scriptsWilliam Hubbs
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.
2017-02-23sh/rc-functions.sh.in: add get_bootparam_value functionWilliam Hubbs
2016-12-18sh/init.sh.Linux.in: remove unused check for Gnu/KFreeBSDWilliam Hubbs
This script only runs on Linux, so the check will always be false.
2016-12-17sh/init.sh.Linux.in: skip /proc test if no md5sumDoug Freed
This will also warn users if md5sum is missing, which serves as a pretty good indicator that /usr is not mounted.
2016-12-17sh/openrc-run.sh: expose default start/stop/statusRobin H. Johnson
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>
2016-12-17Fix typosDoug Freed
Fixes #99
2016-12-01split tmpfiles processing into opentmpfilesWilliam Hubbs
The openntmpfiles package is designed so that it can be used on systems independently of whether openrc is used.
2016-09-22sh/init.sh.Linux.in: update test for live /proc to use md5sumWilliam Hubbs
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
2016-09-20Revert "Remove eval calls from supervisor start functions"William Hubbs
This reverts commit 0d1f1010c299a95332f224c3be9e8dfdd85eec54. We need the eval in case someone uses something like: command_args="this \"is a\" test" This is related to #77.
2016-09-19Remove eval calls from supervisor start functionsWilliam Hubbs
This fixes #77.
2016-09-16Add command_progress variableWilliam Hubbs
If this is set to yes, 1, true, or on, start-stop-daemon will display a progress meter while waiting for a daemon to stop.
2016-09-14Fix permission checks for cgroupsWilliam Hubbs
This is needed because containers may give read access to cgroups but not allow the settings to be changed.
2016-09-13Make use of name vs RC_SVCNAME consistent in supervisor scriptsWilliam Hubbs
This fixes #79.
2016-09-12sh/init.sh: fix the test for cache restorationWilliam Hubbs
This fixes the test for cache restoration since we are no longer caching the dependency tree.
2016-09-06sh/openrc-run.sh: read global configuration settings firstWilliam Hubbs
X-Gentoo-Bug: 503134 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=503134
2016-07-27Add support for runitWilliam Hubbs
X-Gentoo-Bug: 501364 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=501364
2016-07-26tmpfiles.sh: Support lines with q Q h HMartin Väth
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.
2016-07-25tmpfiles: Accept filenames as command line argumentsMike Gilbert
This brings us closer to being able to use tmpfiles.sh as a full replacement for systemd-tmpfiles. This closes #83.
2016-07-25tmpfiles: Process command line before gathering config filesMike Gilbert
This is part of #83.
2016-07-25tmpfiles: Make unrecognized options fatalMike Gilbert
This is part of #83.
2016-05-19supervise-daemon.sh: add support for chroot variableWilliam Hubbs
2016-05-19start-stop-daemon.sh: fix regression in chroot supportWilliam Hubbs
The support for the chroot variable was broken in 0.16, this fixes that breakage.
2016-04-27add daemon supervisorWilliam Hubbs
The supervise-daemon process is meant to be a lightweight supervisor which can monitor and restart a daemon if it crashes.
2016-02-19binfmt.sh: use read in raw modeDustin C. Hatch
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