aboutsummaryrefslogtreecommitdiff
path: root/sh
AgeCommit message (Collapse)Author
2018-12-03supervise-daemon.sh: drop the unused stopsig variableWilliam Hubbs
2018-12-03supervise-daemon: use a default pid file if one is not specifiedWilliam Hubbs
Since the pid file is internal to us, start moving toward deprecating it by not requiring the user to specify it. In the next release, I plan on working on code to start phasing out the use of a pid file if this is possible.
2018-11-18sh/functions.sh.in: return a different value for invalid input in yesno()Austin English
2018-11-15supervise-daemon: make the pidfile an implementation detailWilliam Hubbs
The pidfile of the supervisor doesn't need to be adjustable by the service script. It is only used so the supervisor can stop itself when the --stop option is used.
2018-11-06supervise-daemon.sh: drop invalid --signal switchWilliam Hubbs
This fixes #230.
2018-10-23supervise-daemon: add health checksWilliam Hubbs
Health checks are a way to monitor a service and make sure it stays healthy. If a service is not healthy, it will be automatically restarted after running the unhealthy() function to clean up.
2018-10-13misc: whitespace fixesAustin English
2018-07-09rc-functions.sh: Remove addon supportWilliam Hubbs
This is an old relic from Gentoo baselayout-1.x which should not be used any longer.
2018-06-15sh/start-stop-daemon.sh: fix processing of the logger argumentsWilliam Hubbs
2018-06-15start-stop-daemon: add ability to log stdout or stderr to processesWilliam Hubbs
2018-05-30sh/supervise-daemon.sh: use start_stop_daemon_args if supervise_daemon_args ↵Austin English
is undefined
2018-05-22openrc-run.sh: move crashed test outside started testWilliam Hubbs
This is handled inside librc, so we don't need the nesting in this script.
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.