summaryrefslogtreecommitdiff
path: root/etc/rc.d
AgeCommit message (Collapse)Author
2024-09-23Replace `&&' with `if' for proper $? handling; OK lucasKlemens Nanni
iked and isakmpd guard against themselves with "return 0" as rc.subr(8) checks rc_pre()'s return code and aborts daemo start iff non-zero, but that isn't needed if we use ksh properly.
2024-09-23zap redundant "|| return 1"; OK lucasKlemens Nanni
unbound-checkconf(8) itself exits 1 on error already.
2024-06-03etc bits for dhcp6leasedFlorian Obser
looks correct to deraadt
2024-01-17Zap trailing space.Antoine Jacoutot
from Kirill Miazine, thanks.
2023-12-15Run non-daemons services in a different process group to avoid SIGHUP at bootJeremie Courreges-Anglas
12 factors apps and similar don't daemonize and are thus vulnerable to receiving a SIGHUP signal at the end of /etc/rc. Shield them by running them in a different process group. Do this only for services that need rc_bg=Yes, as suggested by ajacoutot@ There have been several reports about this issue in the past years, the last one being from edd@ who successfully tested this fix. Input from several folks, ok sthen@ ajacoutot@
2022-11-30add configtest; OK martijnKlemens Nanni
2022-10-19Drop support for $rcexec; people should now use the rc_exec function.Antoine Jacoutot
prodded by jsg@
2022-10-14add configtestKlemens Nanni
OK florian
2022-10-14add configtestKlemens Nanni
OK florian
2022-10-10Enable configtestKlemens Nanni
OK solene
2022-09-08_rc_quirks is only called by _rc_parse_conf, so just merge the two.Antoine Jacoutot
ok robert@ sthen@ kn@
2022-09-04Fix regression in previous commit.Antoine Jacoutot
Moving the configuration check to its own configtest function means rc_pre exit code will now be that of the && list (sasyncd_flags). Just do what isakmpd does and return 0. from lucas at sexy dot is, thanks!
2022-09-02Make rc_configtest behave like rc_pre and rc_post; i.e. don't define a defaultAntoine Jacoutot
function (each rc.d script is supposed to define its own if wanted). This way, we can filter out the "configtest" action depending on whether the function exists or not. Adapt documentation. tweak/ok kn@
2022-09-01Add a new action: "configtest", to check configuration syntax of the daemon.Antoine Jacoutot
A few adjustments will be done in the next days (like disabling this action if there's no specific rc_configtest function defined). e.g. /etc/rc.d/sshd configtest rcctl configtest sshd idea from naddy@
2022-08-29When using logger(1), also log the message to standard error so we don'tAntoine Jacoutot
have to check syslog when running in debug mode (`-d').
2022-08-29Use rc_configtest.Antoine Jacoutot
2022-08-29Introduce the rc_configtest() function.Antoine Jacoutot
By default it just returns "0" but can be overriden by rc.d scripts to check that the daemon configuration is valid when running "start", "reload" and "restart".
2022-07-17/var/run/ypbind.lock doesn't need to be forcefully removedTheo de Raadt
ok aja
2022-06-28Hook up bgplgd. Uses _bgplgd user with id 71:71 add a rc.d script andClaudio Jeker
all the other rc plumbing. OK deraadt@
2022-05-26Introduce a new daemon_execdir variable for changing to a specified directoryAntoine Jacoutot
before running rc_rcexec. Based on an proposal from openbsd.tech at aisha.cc ok robert@ abieber@
2022-05-21${rcexec} -> rc_execAntoine Jacoutot
2022-05-21Replace the $rcexec variable by an rc_exec function.Antoine Jacoutot
It is much cleaner to the eyes and makes more sense from a functionnal point of view. This will allow to extend rc_exec with other functionnalities (like upcoming rc_startdir). Bonus point: daemon_logger will now work with manually crafted rc_start functions. This will require a mechanical change from ${rcexec} to rc_exec in rc.d scripts. ports will be fixed right after this commit but we will keep compatibility to give a chance to people to fix their custom scripts. positive tests from a few ok robert@
2022-05-21No need for true(1).Antoine Jacoutot
2022-05-17Simplify unbound rc.d script.Antoine Jacoutot
input/ok sthen@ halex@
2022-04-21Fix previous rc.d/spamlogd commit, the check in rc_pre is not neededStuart Henderson
because rc.subr has special-casing for spamd/spamlogd. Teach the script to detect the pflog interface from spamlogd flags and create the correct interface if needed. ok jturner@
2022-04-11Fix spamlogd's rc_pre to avoid creating pflog0 if spamd is disabled.Stuart Henderson
The conditional was not checked (prior to r1.2 the exit code from the conditional was implicitly used as the exit code from the whole shell function, but this wasn't adapted when pflog creation was added). Reported/tested by Clint Pachl
2022-02-10look for the login class in both login.conf and login.conf.d/${class}Robert Nagy
ok aja@
2021-11-15Tidy up; no change.Antoine Jacoutot
2021-11-14Improve and simplify timer handling in "stop" and "reload".Antoine Jacoutot
Rename _rc_wait to _rc_wait_for_start since only "start" uses this now (to handle rc_bg daemons). In any situation, none of these actions should be able to hang boot or shutdown. We should now be able to manage most corner cases out there ("most" because it's unreasonable to assume we can cope with all the non-default rc_{start,stop,reload} crazyness). Several tests have been made and no obvious regression has been found. But that doesn't mean there isn't; if some behavior changed for the worst, talk to me. ok robert@ sthen@
2021-11-12Consistency in test; no behavior change.Antoine Jacoutot
2021-11-12Set SECONDS to 0 in _rc_wait.Antoine Jacoutot
While this is not strictly required, it's a failsafe and more fair to daemon_timeout as we will effectively wait for the start/stop/reload sequence instead of the duration of the rc.d script itself.
2021-11-12Simplify _rc_exit.Antoine Jacoutot
2021-11-11Run "_rc_wait stop" _before_ stopping the daemon and not after...Antoine Jacoutot
This doesn't change the default behavior but fixes rc.d scripts with a home made rc_stop() function that can block and potentially hangs halt/reboot forever. ok robert@
2021-11-11Return 0 in case we reach KILL; this allows "restart" to work as expectedAntoine Jacoutot
in this situation. reported by and ok robert@
2021-11-11switch(4) and switchd(8) are retiering. Unhook them from variousClaudio Jeker
configuration files. OK sthen@ kn@ patrick@
2021-11-09check that the rc script including rc.subr is using ksh; rc.subr uses kshStuart Henderson
features and scripts will not work correctly with sh. tweak jca/ok kn/ ok with direction aja
2021-11-08rc_reload_signal & rc_stop_signal are not rc.conf(8) variables; they'reAntoine Jacoutot
only for rc.d scripts.
2021-11-07Speed up _rc_wait: only sleep 1/2 second between rc_check tries and make sureAntoine Jacoutot
we have at least 1s for SIGTERM to do its job.
2021-11-07Use built-in SECONDS instead of hand roller timer.Antoine Jacoutot
with a tweak from kn@ ok sthen@
2021-11-06Always run _rc_rm_runfile when process is sent a SIGKILL or rc_post fails (atAntoine Jacoutot
this point the process has been terminated).
2021-11-06Drop uneeded sleep.Antoine Jacoutot
2021-11-06Allow passing a different signal than SIGTERM in the default rc_stop()Antoine Jacoutot
function. This will allow to simplify some rc.d script that cook there own function to gracefully stop a process (e.g. web servers). There are other use cases as well. And do the same for rc_reload because it's cheap and can also simplify a handful of rc.d scripts. Behave like shutdown and if the process is still not down after daemon_timeout (configurable; default to 30s), then send a SIGKILL. While here, factorise pkill invocations into a _rc_sendsig() function that can potentially be used by rc.d scripts instead of cooking pkill lines; this will benefit from the configured routing table etc. tested & ok robert@
2021-10-31Shuffle things around to have FUNCS_ONLY higher in the script so consummersAntoine Jacoutot
source only what they really needs. Only expose the following which are used by /etc/rc, netstart and rcctl: _rc_parse_conf _rc_check_name _rc_err _rc_do _rc_quirk ok sthen@
2021-02-27Add logger(1) support for daemons that are logging to stdout/stderr (mostly fromAntoine Jacoutot
the go ecosystem). Properly handle failing daemon startup now that we have pipefail. To take advantage of this new feature, just add foo_logger=facility to the daemon rc.d(8) script or in rc.conf.local(8) or use rcctl: rcctl set foo logger daemon.info tweak for checking flags in rcctl(8) from martijn@ "this looks pretty good" deraadt@ ok sthen@
2021-02-26Ship resolvd service, enable it by defaultkn
Starting right after unwind. OK deraadt
2021-02-26rc(8) bits for dhcpleased(8).Florian Obser
OK deraadt
2020-07-12Use su -fl to avoid sourcing /etc/profile / the target user's .profileJeremie Courreges-Anglas
This way rc.d and rcctl don't suffer from side effects in people's rc files. If you somehow used those files to set environment variables, you should have used login.conf as described in rc.d(8) instead. ok ajacoutot@
2020-04-29Sort variables and fix a comment.Antoine Jacoutot
No functional change.
2020-02-22Do not run _rc_parse_conf of /var/run/rc.d/foobar on "start".Antoine Jacoutot
This is needed in case a foobar fails to start but still returns 0. Changing its flags (in rc.conf.local) would then get ignored because of this cache (which is around to handle stop/check/reload on flags changes). claudio@ reported this issue when struggling with prometheus several weeks ago
2020-01-25sync rc.d/sshd with sshd proctitle change - listener has been modified toStuart Henderson
keep command-line arguments again; ok aja@ djm@