summaryrefslogtreecommitdiff
path: root/etc/rc.d/rc.subr
AgeCommit message (Collapse)Author
2017-01-24Whitespace.Antoine Jacoutot
2016-09-07Introduce an _rc_check_name() function to check the input script name so thatAntoine Jacoutot
we don't end up with cryptic error messages. Regex help from rpe@ Issue reported by Anthony Coulter in rcctl(8), but better fix the root cause. Also clarify the mage page that rc.d script name must follow ksh(1) variable naming. ok robert@ sthen@
2016-08-31use tab.Antoine Jacoutot
2016-05-03signal name should be first, fixes reload; ok deraadt@Otto Moerbeek
2016-04-28Experiment on matching on the daemon_user is over. It needs more work.Antoine Jacoutot
portmap isn't happy with it as reported by naddy@
2016-04-27Revert the revert and match on the daemon_user again.Antoine Jacoutot
We'll see if something else breaks but it's the right thing to do. discussed with robert@
2016-04-27Revert matching on the daemon user for now; it breaks sndiod handling whichAntoine Jacoutot
does start as root but does not have a root master process and instead changed its uid. reported by deraadt@
2016-04-26Bump copyright.Antoine Jacoutot
2016-04-26Introduce rtable(4) support to rc.subr(8).Antoine Jacoutot
It works by adding daemon_rtable=$id in /etc/rc.conf.local. rcctl(8) support coming in a few and so are the man pages bits. If you want multiple instances of the same daemon running in different routing tables, just symlink the original rc.d script. e.g. # cd /etc/rc.d && ln -s dhcpd dhcpd42 Then enable your daemons as such in rc.conf.local: dhcpd_flags= dhcpd42_flags= dhcpd42_rtable=42 most work done by Jiri B <jirib@devio.us>; with a few tweaks and simplifications by yours truly ok robert@ ... should make henning happy ;-)
2016-04-26Extend _RC_RUNFILE (/var/run/rc.d/scriptname) content with:Antoine Jacoutot
daemon_class, daemon_flags, daemon_timeout, daemon_user, pexp Add "pexp" as a valid variable to _rc_parse_conf() and sort the list while here. Besides having an easy way to see how a daemon was started exactly, it opens the door to rdomain/rtable support in rc.d(8). We need to have as much information on a daemon as possible if we want to target a specific rtable (using -T) and it also makes it easier to start multiple instances of the same daemon with similar flags as a different user... Of course that only works with rc.d scripts *not* overwritting the default rc_* functions. Man page tweaks coming later. discussed with and ok robert@
2016-03-26Make it possible to get usage as a non-root user.Antoine Jacoutot
ok robert@
2016-03-26Handle the rc_stop=NO => rc_restart=NO case within _rc_not_supported().Antoine Jacoutot
2015-12-21Revert, rc.d scripts have been fixed.Antoine Jacoutot
2015-12-21Comment the wait for start until I fix the x11 managers rc.d script.Antoine Jacoutot
2015-12-19After starting, unconditionally wait up to $daemon_timeout seconds to check thatAntoine Jacoutot
the daemon is actually running (instead of only when using rc_bg). This *may* trigger the following side effect: if a daemon starts then stops right away (because of a config parsing issue for e.g.), then it will slow down the boot process because rc will wait a bit before considering the start action failed. But at least it will allow us to detect those daemons and fix them or their rc.d(8) script. At least as far as I can tell, all base daemons should cope with it just fine. ok sthen@ robert@ on an earlier diff
2015-12-19Tidy up _rc_wait().Antoine Jacoutot
ok sthen@ robert@
2015-12-05It does not make sense to insert a specific route for 224/4 when theMartin Pieuchot
default one is good enough. So merge rc.conf(8)'s 'multicast_router' and 'multicast_host' into a single 'multicast'. If set to YES the reject route for 224/4 is not inserted by netstart(8). Manual bits from jmc@ ok henning@, ajacoutot@
2015-10-16Missing local.Antoine Jacoutot
ok schwarze@
2015-07-15By default, require an exact match of the process name and argument list.Antoine Jacoutot
This allows running several instances of the same rc.d(8) script by just linking it to different name. e.g. ln -s ftpproxy ftpproxy6 echo 'ftpproxy6_flags=-6' >>/etc/rc.conf.local This is likely to break some rc.d scripts in ports. I will try and fix them all in the next few days but I'd appreciate reports if I missed some. ok halex@
2015-07-15Always use the default flags when running !start.Antoine Jacoutot
This is necessary so that rc.d scripts launched with `-f' can be properly stopped, checked and reloaded. ok schwarze@
2015-07-15Merge comments.Antoine Jacoutot
2015-06-17Really make daemon_class read-only; it's set to "daemon" of a matchingAntoine Jacoutot
login class.
2015-05-02No more pf_rules ipsec_rules.Antoine Jacoutot
2015-04-29Check arguments before eval so we don't end up with a cryptic error message.Antoine Jacoutot
reported by jasper@ While here: _rc_is_supported() -> _rc_not_supported() - saves a fork - reduces triple negation to double negation in _rc_not_supported() - simplifie condition for rc_restart=NO from schwarze@ ok jasper@ schwarze@
2015-03-28_rc_err(): only display error message if there's an actual one.Antoine Jacoutot
Remove an exit() statement that could never be reached.
2015-01-02Fix return code of _rc_quirks().Antoine Jacoutot
ok robert@
2015-01-02Add a comment about the default values being duplicated in rcctl(8).Antoine Jacoutot
discussed with schwarze@
2014-11-17"reload" should fail if the service is not running in the first place.Antoine Jacoutot
ok robert@ sthen@
2014-08-30Make it possible to pass a specific error code to _rc_err().Antoine Jacoutot
ok robert@ schwarze@
2014-08-25Put _rc_err argument under quotes to respect the syntax we are passing.Antoine Jacoutot
2014-08-24Fix reversed logic.Antoine Jacoutot
ok schwarze@
2014-08-24Drop uneeded parenthesis in usage().Antoine Jacoutot
ok schwarze@
2014-08-24Drop unused variables.Antoine Jacoutot
2014-08-24In debug mode, make it clear when we are using the default flags whenAntoine Jacoutot
none are set. initial patch from me but reworked by schwarze@ ok schwarze@
2014-08-24In debug mode (`-d'), only print the flags relevant to the rc.d(8) we areAntoine Jacoutot
calling instead of all flags which makes it very difficult to see the information we actually need. ok schwarze@ robert@
2014-08-21Drop sanitation, _rc_parse_conf does this for us already.Antoine Jacoutot
ok schwarze@
2014-08-17When running interactively, display the output of the "check" actionAntoine Jacoutot
(ok or failed) like we do with all other actions. ok jung@ rpe@
2014-08-11Typo.Antoine Jacoutot
ok kili@
2014-08-11Let _rc_parse_conf stick to parsing /etc/rc.conf and /etc/rc.conf.localMatthias Kilian
if it's invoked without parameters. It's simpler than adding adding /etc/rc.conf and /etc/rc.conf.local parameters whereever _rc_parse_conf is used (e.g. /etc/rc and /etc/netstart). While here, replace a for foo in "$@"; do something; done by for foo; do something; done ok aja@
2014-08-11Make it possible to pass arguments to _rc_parse_conf().Antoine Jacoutot
ok robert@
2014-08-01Don't return, just skip over non existing rc.conf or rc.conf.local file.Robert Peichaer
OK ajacoutot@ halex@
2014-07-31In debug mode, properly sort and drop duplicates so that we don't endAntoine Jacoutot
up with a confusing output like: multicast_host >NO< <...> multicast_host >YES< Also properly evaluate values _after_ running _rc_quirks() because these can modify flags. ok robert@ halex@
2014-07-30Fix evil typo (multicast_hosts -> multicast_host).Antoine Jacoutot
2014-07-12replace the heavy shell magic in quirks to handle backward compat with simplerRobert Nagy
methods
2014-07-12Make rc.conf a parsed configuration file and stop sourcing it as a shellRobert Nagy
script. From now on rc.conf has a fixed syntax (key=val) and it is not allowed to add anything to it besides the supported syntax, it all going to be ignored. discussed with and help from deraadt@ and halex@
2014-07-09Add a daemon_timeout variable for rc_wait().Antoine Jacoutot
It represents the maximum time in seconds to wait for the start, stop and reload actions to return. Defaults to "30". No default behavior is changed. ok beck@ sthen@ jasper@ giovanni@
2014-07-09White spaces.Antoine Jacoutot
2013-07-11no double negatives in error message; ok aja@Otto Moerbeek
2013-04-04Show only available actions in RC script usage messages.Vadim Zhukov
Also, prettify representation of actions list a bit. a lot of input and ok halex@ aja@ also ok schwarze@ small nit spotted by marc@ "makes a lot of sense to me" todd@
2012-11-19Remove useless test: rc_rm_runfile() uses rm -f which always returns 0Antoine Jacoutot
so we don't care if the file is present or not; also this function should never return a failure. ok halex@