Age | Commit message (Collapse) | Author |
|
|
|
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@
|
|
so we don't care if the file is present or not; also this function
should never return a failure.
ok halex@
|
|
from /etc/rc(8). This prevents the warning to be displayed at shutdown
time when the script has rc_stop=NO.
req. and input from fgsch@
"go ahead" schwarze@
input from an ok halex@, ok robert@
|
|
it unconditionally.
The only place local_rcconf could have been defined is from /etc/rc
sourcing rc.conf but then the variable is not exported so it will never
be seen by rc.subr.
ok robert@
|
|
ok sthen@
|
|
There is no reason we couldn't reload|stop a daemon even when _flags is
set to NO.
As a bonus side effect, we can now see usage() on disabled scripts.
discussed with sthen@ and espie@
ok sthen@
|
|
to /dev/null.
|
|
scripts; from robert at peichaer dot org
ok halex@
While here, put the "sanitation" commands in their own block.
|
|
such).
from robert at peichaer dot org
modified after a discussion with halex@
ok halex@ robert@
|
|
from robert at peichaer dot org
ok halex@
|
|
privilege is needed to run rc_check.
In effect this means /etc/rc.d/foobar check can now be run as a regular
user.
Discussed with robert@ during g2k12.
ok todd@
|
|
initially from robert at peichaer dot org with some enhancement by halex@
ok halex@
|
|
daemon is not active (happens often to me, as I forget which box has
which daemons).
okay ajacoutot@
|
|
regular user, member of the operator group); rm(1) was waiting for
interactive input to remove the runfiles which made no sense, so just
use `-f'.
issue spotted by weerd@
ok weerd@ robert@
|
|
just leave them untouched
ok ajacoutot@ sthen@ schwarze@
|
|
might pick it up from a polluted environment.
Requested by halex@, ok ajacoutot@ halex@
|
|
reading it failed, ${pexp} ended up as the empty string and the script
would send SIGTERM to init(1), which was really inconvenient.
Fix that by never allowing pexp to become empty.
My patch considerably simplified by and ok ajacoutot@.
|
|
its _flags in rc.conf(8).
When the rc.d(8) system starts a daemon, it will record its pexp under
/var/run/rc.d/rcscriptname and use that to interact with it (errors in
creating /var/run/rc.d or missing pexp file are non fatal, the framework
will just fallback to what it currently does).
deraadt@ doesn't mind a long as it doesn't come in the way of people
manually managing their daemons.
discussed with and input from sthen@ halex@ robert@ schwarze@
ok sthen@ robert@
|
|
ok robert@
|
|
mistake in the previous commit.
No functionnal change.
ok robert@
|
|
dance on restart rather than exporting them and expose the script to a
potentially polluted environment
ok ajacoutot@ robert@
|
|
RC_FORCE since "restart" calls "stop" then "start").
While here, append "_" to these variable names to make it clear they are
internal.
ok robert@
|
|
unset beforehands; prodded by halex@
Add rc_usage().
ok halex@
|
|
debug mode.
This commit also adds a force mode for the script to allow one to force
operations even if daemon_flags is set to NO.
In this case the sane default values will be used for each script.
e.g.: "/etc/rc.d/foo -f start" will start sshd even if it's disabled
ok ajacoutot@
|
|
from david@, okay sthen@ and input from schwarze@
|
|
|
|
better visual cues as to what's happening. Feedback/ok aja@ schwarze@
|
|
|
|
* if we try to reload a non running daemon, just exit gracefully, like
we do for 'stop'
* add an rc_check call right after rc_reload to make sure the daemon is
still around; until now we only checked the pkill(1) return code but
that is not enough
ok robert@
|
|
From now on rc(8) is going to call these scripts to start them up on boot
in the same order than before.
In addition the inetd and rwhod variables in rc.conf are deprecated so that
inetd_flags and rwhod_flags should be used. The old flags are still going
to be used for some time to allow users to switch.
There are more rc modifications to come later so let's put this in so
we can base more work on this.
It is important to mention that you can still keep using rc.local just
like the way you did before, and we have no intention to remove that either.
I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working
on this with me.
|
|
ajacoutot@ and robert@ couldn't really remember the reason to be different,
either
|
|
* Instead of nesting subshells, perform a linear series of operations
and bail out as soon as one of them fails.
* Rename rc_print to rc_exit, let it calculate the exit code itself
and let it exit, considerably simplifying error handling; new name
suggested by sthen@.
OK ajacoutot@ sthen@
|
|
the correct code according whether the daemon did start successfully or
not.
rc_wait()
This function has been extended, first we need to pass in which mode we
are running (start or stop) and second we can pass a number of seconds
to wait (optionnal, will default to 30s).
The function will return the correct code whether we are running during
"rc_cmd start" or "rc_cmd stop".
rc_cmd() start
If we are running in background mode, then we call rc_wait with the
"start" argument.
The sleep(1) is needed to prevent a race condition where the process
will appear in the list before failing and rc_check will see it as
running. Call rc_post() when failing to prevent being left in an
inconsistent state (because rc_pre() would have run successfully)
rc_cmd() stop
We are now calling rc_wait with the "stop" argument.
"looks good" sthen@, ok robert@
|
|
"1".
hint from MERIGHI Marcus
ok robert@
|
|
- As noticed by ajacoutot@, re_format(7) does not treat '\t' as a tab,
so some t's got stripped from daemon names.
- The tr(1) failed to sanitize mixtures of blanks and tabs.
ok ajacoutot@
|
|
- (ok) is only printed while in interactive mode, but (failed) stays
even for rc if the command fails
ok ajacoutot@
|
|
ok schwarze@
|
|
ok otto@, aja@
|
|
from Piotr Sikora
ok robert@
|
|
ok robert@
|
|
ok ajacoutot@
|
|
so remove that test condition. Commented by schwarze@, OK ajacoutot@
|
|
gets called from rc.local or rc.shutdown
- notify the user if a given operation was successfull or not by appending
the (ok) or (failed) strings to the end of the daemon name
- hide stdout and stdin unless RC_DEBUG=1 is set, otherwise all the function
names will be printed out and all output sent to stdin or stdout
- since from now on rc.subr is taking care of printing out the daemon names
on startup, we don't need to do this from rc.{local,shutdown} anymore
brainkilling work done by me and ajacoutot@, ok ajacoutot@
|
|
don't rc_post if rc_stop failed.
"I agree with the direction" sthen@
ok robert@
|
|
Use $() constructs as it's safer than ``.
Both req. by deraadt@
Use pkill instead of pgrep in rc_check so that we don't need to fiddle
with redirections in reload.
prodded by schwarze@
ok robert@
|
|
ok robert@
|
|
rc_stop so scripts don't need to set it.
ok sthen@ (on a much bigger diff) robert@
|
|
rc_cmd start/stop actions. This way when rc.d(8) scripts override these
functions, we don't loose rc_{pre,post}.
Add a max 5 secs loop after rc_stop in the rc_cmd top action. This seems
to be a good default for returning to command line only after the daemon
has really stopped. This fixes "restart" for some daemons and allows to
properly stop some others at shutdown time.
Note that this is just a best-effort default, some daemons may need a
lot more time to shutdown but this case is usually handled in the
rc.d(8) script itself and we obviously do not want to hang the shutdown
process.
Call rc_cmd start/stop in restart and _not_ rc_start/rc_stop which can
get overriden in a script.
discussed with and inputs from sthen@ and schwarze@
ok sthen@ robert@
|
|
a daemon in the background.
man page tweaks from schwarze@
discussed with an ok schwarze@ robert@
|