OpenBSD CVS

CVS log for src/usr.sbin/rcctl/rcctl.sh


[BACK] Up to [local] / src / usr.sbin / rcctl

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.117 / (download) - annotate - [select for diffs], Thu Jul 13 13:54:27 2023 UTC (10 months, 3 weeks ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.116: +14 -6 lines
Diff to previous 1.116 (colored)

Check input before trying to disable a non-existing daemon to prevent parsing
bogus characters and outputing hell on the console.

based on an initial submission from Anthony Coulter, thanks!

Revision 1.116 / (download) - annotate - [select for diffs], Mon Apr 24 14:31:15 2023 UTC (13 months, 2 weeks ago) by kn
Branch: MAIN
Changes since 1.115: +2 -2 lines
Diff to previous 1.115 (colored)

"ls rogue" needs root;  OK aja

Revision 1.115 / (download) - annotate - [select for diffs], Thu Dec 22 19:53:24 2022 UTC (17 months, 2 weeks ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.114: +2 -2 lines
Diff to previous 1.114 (colored)

Denote multiple arguments with 'arg ...' not 'args'

A few programs used the plural in their synopsis which doesn't read as
clear as the obvious triple-dot notation.

mdoc(7) .Ar defaults to "file ..." if no arguments are given and consistent
use of 'arg ...' matches that behaviour.

Cleanup a few markups of the same argument so the text keeps reading
naturally;  omit unhelpful parts like 'if optional arguments are given,
they are passed along' for tools like time(1) and timeout(1) that obviously
execute commands with whatever arguments where given -- just like doas(1)
which doesn't mention arguments in its DESCRIPTION in the first place.

For expr(1) the difference between 'expressions' and 'expression ...' is
crucial, as arguments must be passed as individual words.

Feedback millert jmc schwarze deraadt
OK jmc

Revision 1.114 / (download) - annotate - [select for diffs], Thu Sep 1 07:25:32 2022 UTC (21 months, 1 week ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.113: +3 -3 lines
Diff to previous 1.113 (colored)

Add a new action: "configtest", to check configuration syntax of the daemon.
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@

Revision 1.113 / (download) - annotate - [select for diffs], Thu May 26 11:27:03 2022 UTC (2 years ago) by ajacoutot
Branch: MAIN
Changes since 1.112: +22 -10 lines
Diff to previous 1.112 (colored)

Introduce a new daemon_execdir variable for changing to a specified directory
before running rc_rcexec.

Based on an proposal from openbsd.tech at aisha.cc
ok robert@ abieber@

Revision 1.112 / (download) - annotate - [select for diffs], Thu Feb 10 16:57:33 2022 UTC (2 years, 3 months ago) by robert
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.111: +3 -3 lines
Diff to previous 1.111 (colored)

look for the login class in both login.conf and login.conf.d/${class}

ok aja@

Revision 1.111 / (download) - annotate - [select for diffs], Sat Oct 23 08:19:27 2021 UTC (2 years, 7 months ago) by sthen
Branch: MAIN
Changes since 1.110: +10 -3 lines
Diff to previous 1.110 (colored)

add "rcctl ls rogue", to show daemons which are running but not set as
"enabled" in rc.conf.local.

naming suggesting from schwarze@, ok kn@ ajacoutot@

Revision 1.110 / (download) - annotate - [select for diffs], Sat Feb 27 09:28:04 2021 UTC (3 years, 3 months ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.109: +22 -8 lines
Diff to previous 1.109 (colored)

Add logger(1) support for daemons that are logging to stdout/stderr (mostly from
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@

Revision 1.109 / (download) - annotate - [select for diffs], Thu Feb 18 06:17:35 2021 UTC (3 years, 3 months ago) by ajacoutot
Branch: MAIN
Changes since 1.108: +2 -2 lines
Diff to previous 1.108 (colored)

Only pick up files matching alphanumeric and underscore characters under
/etc/rc.d. This prevents issues with editor backup files (foo~) or other bogus
files.

ok sthen@

Revision 1.108 / (download) - annotate - [select for diffs], Tue Mar 31 08:03:44 2020 UTC (4 years, 2 months ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.107: +2 -1 lines
Diff to previous 1.107 (colored)

Missing semi-colons.

Revision 1.107 / (download) - annotate - [select for diffs], Sun Oct 21 21:20:40 2018 UTC (5 years, 7 months ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.106: +2 -2 lines
Diff to previous 1.106 (colored)

explicitely -> explicitly
from Hiltjo Posthuma

Revision 1.106 / (download) - annotate - [select for diffs], Tue May 30 12:04:27 2017 UTC (7 years ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.105: +3 -2 lines
Diff to previous 1.105 (colored)

Introduce a scary rc.conf(8) knob library_aslr=(YES|NO) to turn off the
reordering of libraries by rc(8). This way machines with very slow disk I/O
have a chance of booting within reasonable time now that libcrypto is also
randomized.

Discussed with various;
input & ok from deraadt ajacoutot

Revision 1.105 / (download) - annotate - [select for diffs], Wed Sep 7 13:13:13 2016 UTC (7 years, 9 months ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.104: +2 -2 lines
Diff to previous 1.104 (colored)

Validate service names with _rc_check_name() from rc.subr.

ok sthen@ robert@

Revision 1.104 / (download) - annotate - [select for diffs], Sat Jul 30 06:25:21 2016 UTC (7 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.103: +2 -2 lines
Diff to previous 1.103 (colored)

This is effectively a ksh(1) script.

Revision 1.103 / (download) - annotate - [select for diffs], Tue Jul 19 08:28:03 2016 UTC (7 years, 10 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.102: +2 -2 lines
Diff to previous 1.102 (colored)

In rcctl ls, skip all files with a '.' in the name, not just rc.subr;
pkg_add renames files in this way when the checksums don't match at update
or removal time. [[ ]] suggestion from guenther@ to avoid the messy "case"
that I had in my first diff. Other feedback/suggestions from halex aja
millert, ok halex@ aja@.

Revision 1.102 / (download) - annotate - [select for diffs], Sun Jun 19 15:00:37 2016 UTC (7 years, 11 months ago) by ajacoutot
Branch: MAIN
Changes since 1.101: +19 -10 lines
Diff to previous 1.101 (colored)

Replace some expensive evals.

Revision 1.101 / (download) - annotate - [select for diffs], Sun Jun 19 11:32:25 2016 UTC (7 years, 11 months ago) by ajacoutot
Branch: MAIN
Changes since 1.100: +13 -13 lines
Diff to previous 1.100 (colored)

Do caching differently.

Revision 1.100 / (download) - annotate - [select for diffs], Sun Jun 19 11:14:20 2016 UTC (7 years, 11 months ago) by ajacoutot
Branch: MAIN
Changes since 1.99: +13 -13 lines
Diff to previous 1.99 (colored)

Temporarily turn caching off; there's a small regression when enabling
multiple daemons at once; being worked on.

Revision 1.99 / (download) - annotate - [select for diffs], Sun Jun 19 10:54:20 2016 UTC (7 years, 11 months ago) by ajacoutot
Branch: MAIN
Changes since 1.98: +12 -7 lines
Diff to previous 1.98 (colored)

Implement rcctl get|getdef all.
With this and the previous 2 commits, we can move from constructs like:
$ for i in $(rcctl ls all); do rcctl get $i; done
to just:
$ rcctl get all
Shrinking the run by a factor of more than 3.5.

prodded by and discussed with reyk@ at BSDcan2016
ok robert@

Revision 1.98 / (download) - annotate - [select for diffs], Sun Jun 19 10:50:27 2016 UTC (7 years, 11 months ago) by ajacoutot
Branch: MAIN
Changes since 1.97: +19 -1 lines
Diff to previous 1.97 (colored)

Cache result of often used functions (svc_is_{base,meta,special}).
Large speedup when iterating over all rc.d scripts.

with and ok robert@

Revision 1.97 / (download) - annotate - [select for diffs], Sun Jun 19 10:46:08 2016 UTC (7 years, 11 months ago) by ajacoutot
Branch: MAIN
Changes since 1.96: +2 -3 lines
Diff to previous 1.96 (colored)

grep(1) /etc/rc.conf instead of /etc/rc to detect whether a particular
rc.d script comes from base of not; it's much faster.

ok robert@

Revision 1.96 / (download) - annotate - [select for diffs], Fri Jun 17 11:24:58 2016 UTC (7 years, 11 months ago) by ajacoutot
Branch: MAIN
Changes since 1.95: +2 -2 lines
Diff to previous 1.95 (colored)

No need to hardcode return code.

Revision 1.95 / (download) - annotate - [select for diffs], Tue Apr 26 18:39:29 2016 UTC (8 years, 1 month ago) by ajacoutot
Branch: MAIN
Changes since 1.94: +13 -7 lines
Diff to previous 1.94 (colored)

It's ok to disable a non-existing daemon.
Think "pkg_delete foobar && rcctl disable foobar".

Revision 1.94 / (download) - annotate - [select for diffs], Tue Apr 26 17:58:42 2016 UTC (8 years, 1 month ago) by ajacoutot
Branch: MAIN
Changes since 1.93: +20 -7 lines
Diff to previous 1.93 (colored)

Implement daemon_rtable support.
From Jiri B <jirib ! devio ! us>, thanks!

Revision 1.93 / (download) - annotate - [select for diffs], Sat Apr 9 08:02:22 2016 UTC (8 years, 2 months ago) by ajacoutot
Branch: MAIN
Changes since 1.92: +5 -2 lines
Diff to previous 1.92 (colored)

Use builtin.

Revision 1.92 / (download) - annotate - [select for diffs], Fri Apr 1 08:18:57 2016 UTC (8 years, 2 months ago) by ajacoutot
Branch: MAIN
Changes since 1.91: +5 -5 lines
Diff to previous 1.91 (colored)

Rename the 'faulty' list action to 'failed'; it clearer.

prodded by matthieu@
ok millert@ jung@ sthen@

Revision 1.91 / (download) - annotate - [select for diffs], Mon Mar 28 08:10:19 2016 UTC (8 years, 2 months ago) by ajacoutot
Branch: MAIN
Changes since 1.90: +1 -3 lines
Diff to previous 1.90 (colored)

Remove left-over debug line.

Revision 1.90 / (download) - annotate - [select for diffs], Sun Mar 27 13:11:33 2016 UTC (8 years, 2 months ago) by ajacoutot
Branch: MAIN
Changes since 1.89: +4 -2 lines
Diff to previous 1.89 (colored)

Compute "action" from the _rc_actions variable.

Revision 1.89 / (download) - annotate - [select for diffs], Sun Mar 27 13:06:00 2016 UTC (8 years, 2 months ago) by ajacoutot
Branch: MAIN
Changes since 1.88: +3 -3 lines
Diff to previous 1.88 (colored)

Make usage() a bit more user friendly wrt "action" and "lsarg".

prodded by espie@

Revision 1.88 / (download) - annotate - [select for diffs], Sun Jan 24 08:51:50 2016 UTC (8 years, 4 months ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.87: +2 -2 lines
Diff to previous 1.87 (colored)

Check all daemons in "faulty", not just the base ones.
reported by landry@

Revision 1.87 / (download) - annotate - [select for diffs], Sun Dec 6 14:24:48 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.86: +2 -3 lines
Diff to previous 1.86 (colored)

multicast_{host,router} -> multicast.

ok ajacoutot@

Revision 1.86 / (download) - annotate - [select for diffs], Sun Nov 29 15:58:59 2015 UTC (8 years, 6 months ago) by ajacoutot
Branch: MAIN
Changes since 1.85: +44 -37 lines
Diff to previous 1.85 (colored)

Better cope with meta rc.d scripts; these are ugly but well...

Revision 1.85 / (download) - annotate - [select for diffs], Sun Nov 1 10:59:23 2015 UTC (8 years, 7 months ago) by ajacoutot
Branch: MAIN
Changes since 1.84: +6 -6 lines
Diff to previous 1.84 (colored)

Tweak wording.
Make sure the rc.d script exist in svc_is_meta().

Revision 1.84 / (download) - annotate - [select for diffs], Sat Oct 31 11:09:41 2015 UTC (8 years, 7 months ago) by ajacoutot
Branch: MAIN
Changes since 1.83: +13 -1 lines
Diff to previous 1.83 (colored)

Only handle meta scripts for rc.d actions and enable/disable only.

ok sthen@

Revision 1.83 / (download) - annotate - [select for diffs], Sat Oct 24 13:57:24 2015 UTC (8 years, 7 months ago) by ajacoutot
Branch: MAIN
Changes since 1.82: +8 -5 lines
Diff to previous 1.82 (colored)

"enable" and "disable" are here to stay now that they have a real added value
(possibility to pass several enable|disable daemons at once); so document them.
While here, add a check to make sure a service|daemon exists when running "order".

"Yay" and ok sthen@

Revision 1.82 / (download) - annotate - [select for diffs], Tue Oct 6 18:46:05 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.81: +6 -3 lines
Diff to previous 1.81 (colored)

With growing functionality, the synopsis became long and confusing.
The syntax of some subcommands has almost nothing in common with the
syntax of others.  So split the synopsis to make it more readable.
"if you feel it helps, go for it"  jmc@ ajacoutot@

Revision 1.81 / (download) - annotate - [select for diffs], Sun Oct 4 13:38:11 2015 UTC (8 years, 8 months ago) by ajacoutot
Branch: MAIN
Changes since 1.80: +71 -42 lines
Diff to previous 1.80 (colored)

Make it possible to give the same action to several daemons at once.
e.g.
# rcctl restart sshd ntpd

from Martijn van Duren with tweaks
ok sthen@

Revision 1.80 / (download) - annotate - [select for diffs], Sat Oct 3 10:39:21 2015 UTC (8 years, 8 months ago) by ajacoutot
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored)

Properly indent usage() output.

Revision 1.79 / (download) - annotate - [select for diffs], Wed Aug 12 06:28:18 2015 UTC (8 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.78: +2 -6 lines
Diff to previous 1.78 (colored)

Remove getall now that we're post 5.8.

Revision 1.78 / (download) - annotate - [select for diffs], Mon Aug 3 13:18:48 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.77: +2 -4 lines
Diff to previous 1.77 (colored)

"ls" requires an argument.

issue reported by kirby@
"hurry up" deraadt@

Revision 1.77 / (download) - annotate - [select for diffs], Sat Aug 1 11:28:14 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.76: +3 -3 lines
Diff to previous 1.76 (colored)

Tweak needs_root() output.
When using "ls" with a root action, properly output the action and flags
in the error output; from Theo Buehler

Revision 1.76 / (download) - annotate - [select for diffs], Sat Jul 25 04:12:43 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

Fix usage() output.

from Michael Reed

Revision 1.75 / (download) - annotate - [select for diffs], Fri Jul 17 18:00:43 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.74: +2 -1 lines
Diff to previous 1.74 (colored)

return 0 when using "getall"

spotted by jasper@

Revision 1.74 / (download) - annotate - [select for diffs], Thu Jul 16 23:05:12 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.73: +3 -2 lines
Diff to previous 1.73 (colored)

Consistency

Revision 1.73 / (download) - annotate - [select for diffs], Thu Jul 16 22:03:02 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

No daemon_class for special services.

Revision 1.72 / (download) - annotate - [select for diffs], Thu Jul 16 21:52:16 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.71: +6 -6 lines
Diff to previous 1.71 (colored)

Shorten variable name.

Revision 1.71 / (download) - annotate - [select for diffs], Wed Jul 15 04:19:41 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.70: +15 -4 lines
Diff to previous 1.70 (colored)

Make it possible to get the daemon_class.

Revision 1.70 / (download) - annotate - [select for diffs], Wed Jul 15 03:00:46 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.69: +5 -3 lines
Diff to previous 1.69 (colored)

Sort 'ls all'.

Revision 1.69 / (download) - annotate - [select for diffs], Tue Jul 14 23:16:56 2015 UTC (8 years, 10 months ago) by ajacoutot
Branch: MAIN
Changes since 1.68: +90 -30 lines
Diff to previous 1.68 (colored)

Deprecate getall (will be removed after 5.8).
Implement a new "ls" subcommand, to list daemons according to the argument
(all, started, ...).

input and ok robert@
ok jasper@

Revision 1.68 / (download) - annotate - [select for diffs], Sat Mar 28 08:08:52 2015 UTC (9 years, 2 months ago) by ajacoutot
Branch: MAIN
Changes since 1.67: +4 -1 lines
Diff to previous 1.67 (colored)

Add comment.

Revision 1.67 / (download) - annotate - [select for diffs], Sat Mar 28 07:41:46 2015 UTC (9 years, 2 months ago) by ajacoutot
Branch: MAIN
Changes since 1.66: +29 -18 lines
Diff to previous 1.66 (colored)

Add rcctl_err() which is a wrapper for _rc_err() with common rcctl(8) verbiage.
Add some explicit error messages while here.

Prefer cat over cp/mv to edit rc.conf.local; this prevents creating
rc.conf.local with mode 0600.

Revision 1.66 / (download) - annotate - [select for diffs], Mon Mar 2 06:58:42 2015 UTC (9 years, 3 months ago) by ajacoutot
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.65: +2 -2 lines
Diff to previous 1.65 (colored)

Extend previous.

ok sebastia@

Revision 1.65 / (download) - annotate - [select for diffs], Sun Mar 1 18:38:05 2015 UTC (9 years, 3 months ago) by sebastia
Branch: MAIN
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

svc_is_base function didn't catched all base daemons, apparently found
trying to manage rtadvd with it.

OK ajacoutot@

Revision 1.64 / (download) - annotate - [select for diffs], Sun Jan 18 10:29:53 2015 UTC (9 years, 4 months ago) by ajacoutot
Branch: MAIN
Changes since 1.63: +7 -23 lines
Diff to previous 1.63 (colored)

Drop backward compat syntax.

Revision 1.63 / (download) - annotate - [select for diffs], Mon Jan 12 14:40:35 2015 UTC (9 years, 4 months ago) by ajacoutot
Branch: MAIN
Changes since 1.62: +5 -1 lines
Diff to previous 1.62 (colored)

Make sure the given user exists.

"I like it" sthen@
ok robert@

Revision 1.62 / (download) - annotate - [select for diffs], Mon Jan 12 13:51:20 2015 UTC (9 years, 4 months ago) by ajacoutot
Branch: MAIN
Changes since 1.61: +6 -7 lines
Diff to previous 1.61 (colored)

Make it possible to reset "timeout" to the default value.

Revision 1.61 / (download) - annotate - [select for diffs], Mon Jan 12 13:40:12 2015 UTC (9 years, 4 months ago) by ajacoutot
Branch: MAIN
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored)

"timeout" must be a positive integer.

Revision 1.60 / (download) - annotate - [select for diffs], Thu Jan 8 13:29:34 2015 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.59: +1 -5 lines
Diff to previous 1.59 (colored)

"default" is gone.

Revision 1.59 / (download) - annotate - [select for diffs], Tue Jan 6 14:48:59 2015 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.58: +3 -4 lines
Diff to previous 1.58 (colored)

Simplify special vars argument checking; invalidating some bogus constructs
in the process.

Revision 1.58 / (download) - annotate - [select for diffs], Tue Jan 6 12:49:55 2015 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.57: +2 -2 lines
Diff to previous 1.57 (colored)

While on death-row, 'rcctl status' still is still allowed for now -- so
make its output match the older one.

Revision 1.57 / (download) - annotate - [select for diffs], Tue Jan 6 12:27:42 2015 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.56: +31 -31 lines
Diff to previous 1.56 (colored)

Rename some internal variables (flag and flags is way too error-prone):
flag -> var
flags -> args

Revision 1.56 / (download) - annotate - [select for diffs], Tue Jan 6 11:47:50 2015 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.55: +232 -179 lines
Diff to previous 1.55 (colored)

Major rcctl(8) rewrite to simplify it and add new features. It can now
configure "user" and "timeout". Committing now because there's been no
release yet including rcctl(8) so it's easier to modify its usage.

Usage extended (*retaining full backward compatibility for now*) to:
rcctl set|get|getdef foobar [flags|user|timeout|status]

The followings will be dropped soon but not right now to give people
time to adjust:
rcctl enable sshd flags	# 'enable' takes no flags, use 'rcctl set ...'
rcctl status sshd	# use 'rcctl get sshd [flags|status|timeout|user]'
rcctl default sshd	# use 'rcctl getdef sshd [flags|status|timeout|user]'
rcctl status		# use 'rcctl getall'

Man page changes will come soon. Make sure you have an up-to-date rc.subr.

discussed with schwarze@ robert@ jasper@ sthen@
"love the idea" jasper@
ok schwarze@

Revision 1.55 / (download) - annotate - [select for diffs], Thu Jan 1 09:44:20 2015 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.54: +1 -2 lines
Diff to previous 1.54 (colored)

Drop redundant FUNCS_ONLY.

Revision 1.54 / (download) - annotate - [select for diffs], Tue Dec 30 15:33:53 2014 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.53: +87 -87 lines
Diff to previous 1.53 (colored)

Rename a few functions name. Will help factorize some stuffs.

Revision 1.53 / (download) - annotate - [select for diffs], Tue Dec 30 15:31:33 2014 UTC (9 years, 5 months ago) by robert
Branch: MAIN
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored)

do not print an empty order in case pkg_scripts is undefined
ok ajacoutot@

Revision 1.52 / (download) - annotate - [select for diffs], Tue Dec 30 14:46:33 2014 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.51: +9 -9 lines
Diff to previous 1.51 (colored)

add_flags() does not need any action argument.
Use the flags variable instead of hardcoding the output in preparation for
further subcommands.

Revision 1.51 / (download) - annotate - [select for diffs], Wed Dec 24 13:04:43 2014 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.50: +43 -8 lines
Diff to previous 1.50 (colored)

Implement some kind ordering in the startup of package script daemons.
'rcctl order ...' will prepend the daemon(s) given as argument to the
pkg_scripts line (it can be all daemons, some, or just one).
Without argument, it'll display the current order.

While here, drop a couple of examples from the man page to only leave
the most interesting one.

ok schwarze@ rpe@ (with tweaks) jasper@ robert@ sthen@

Revision 1.50 / (download) - annotate - [select for diffs], Tue Dec 23 10:07:44 2014 UTC (9 years, 5 months ago) by ajacoutot
Branch: MAIN
Changes since 1.49: +25 -25 lines
Diff to previous 1.49 (colored)

Consistency: put variables between curly braces.
No functional change intended.

Revision 1.49 / (download) - annotate - [select for diffs], Sat Nov 1 13:59:42 2014 UTC (9 years, 7 months ago) by ajacoutot
Branch: MAIN
Changes since 1.48: +2 -4 lines
Diff to previous 1.48 (colored)

Simplify.

with and ok schwarze@

Revision 1.48 / (download) - annotate - [select for diffs], Fri Oct 31 09:07:48 2014 UTC (9 years, 7 months ago) by ajacoutot
Branch: MAIN
Changes since 1.47: +3 -1 lines
Diff to previous 1.47 (colored)

Make default output matches status. Hackish but we are not allowed to
use svc_default_enabled_flags like any other function...

Revision 1.47 / (download) - annotate - [select for diffs], Fri Oct 31 09:04:08 2014 UTC (9 years, 7 months ago) by ajacoutot
Branch: MAIN
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

Useless use of sed(1).

ok swartze@

Revision 1.46 / (download) - annotate - [select for diffs], Mon Oct 27 21:24:26 2014 UTC (9 years, 7 months ago) by rpe
Branch: MAIN
Changes since 1.45: +5 -5 lines
Diff to previous 1.45 (colored)

Ensure proper separation of grep's options and rcctl options that
may end up in ${svc} by mistake.

OK ajacoutot@

Revision 1.45 / (download) - annotate - [select for diffs], Wed Oct 15 07:38:24 2014 UTC (9 years, 7 months ago) by ajacoutot
Branch: MAIN
Changes since 1.44: +13 -3 lines
Diff to previous 1.44 (colored)

Add a new ls_rcscripts() function to properly get all rc.d(8) scripts
ignoring irrelevant stuffs under /etc/rc.d.

reworked based on a submission from Craig R. Skinner
ok schwarze@

Revision 1.44 / (download) - annotate - [select for diffs], Mon Oct 13 19:06:53 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +12 -8 lines
Diff to previous 1.43 (colored)

Carefully quote the flags argument such that leading blank characters
are preserved in all situations; this is relevant such that for
example 'rcctl enable identd flags " "' puts 'identd_flags=" "'
into /etc/rc.conf.local and subsequent 'rcctl enable identd' without
flags keeps it intact instead of stripping it down to 'identd_flags='.
ok ajacoutot@

Revision 1.43 / (download) - annotate - [select for diffs], Sat Oct 11 19:12:19 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

Fix a small bug in  rcctl status <daemon>:
If the daemon has default flags in its rc.d(8) script
but its flags are explicitly set to =" " in rc.conf.local(8),
the default flags were erroneously displayed.  Show " " instead.
ok ajacoutot@

Revision 1.42 / (download) - annotate - [select for diffs], Sat Oct 11 13:42:49 2014 UTC (9 years, 8 months ago) by ajacoutot
Branch: MAIN
Changes since 1.41: +33 -10 lines
Diff to previous 1.41 (colored)

Add a new "default" command to  display the default flags and whether a
service is enabled or disabled by default.

idea from Patrik Lundin
discussed with and ok schwarze@

Revision 1.41 / (download) - annotate - [select for diffs], Fri Oct 10 15:59:36 2014 UTC (9 years, 8 months ago) by ajacoutot
Branch: MAIN
Changes since 1.40: +3 -3 lines
Diff to previous 1.40 (colored)

Actually use built-in print like rc.subr already does.

Revision 1.40 / (download) - annotate - [select for diffs], Fri Oct 10 15:42:30 2014 UTC (9 years, 8 months ago) by ajacoutot
Branch: MAIN
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored)

Use printf(1) to prevent '-e' in daemon_flags from being fed as an
argument to the built-in echo.

Revision 1.39 / (download) - annotate - [select for diffs], Fri Oct 10 07:27:44 2014 UTC (9 years, 8 months ago) by ajacoutot
Branch: MAIN
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (colored)

Allow passing flags without arguments for special variables.

initial request and patch from Patrik Lundin
simpler patch from and ok schwartze@

Revision 1.38 / (download) - annotate - [select for diffs], Mon Sep 1 18:01:55 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

Fix evil typo.

from wbyte via Bryan Steele

Revision 1.37 / (download) - annotate - [select for diffs], Sun Aug 31 10:44:37 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.36: +2 -1 lines
Diff to previous 1.36 (colored)

Add Ingo's copyright as per his request.

Revision 1.36 / (download) - annotate - [select for diffs], Sun Aug 31 07:08:25 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.35: +1 -4 lines
Diff to previous 1.35 (colored)

No need to update daemon_flags in the enviroment anymore since the
recent change to append_to_pkg_scripts().

Revision 1.35 / (download) - annotate - [select for diffs], Sat Aug 30 20:37:46 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

When a service is not available, return ENOENT.
Previous to this commit it was not possible to know whether a service
existed without parsing the output of 'rcctl status' which is very
expensive.

req. by armani@
ok robert@ schwarze@

Revision 1.34 / (download) - annotate - [select for diffs], Fri Aug 29 21:04:37 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +4 -1 lines
Diff to previous 1.33 (colored)

Additional input validation:
Error out on "rcctl enable daemon flags NO".
Without this check, this "enable" command effectively disabled the daemon.
"commit" ajacoutot@

Revision 1.33 / (download) - annotate - [select for diffs], Fri Aug 29 20:21:13 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +4 -6 lines
Diff to previous 1.32 (colored)

Simplify append_to_pkg_scripts(), in particular avoid the expensive
svc_is_enabled() and look at ${pkg_scripts} only, flags are not
relevant to this function.
"please commit" ajacoutot@

Revision 1.32 / (download) - annotate - [select for diffs], Thu Aug 28 14:51:16 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.31: +3 -4 lines
Diff to previous 1.31 (colored)

Drop check and tweak comment.

with schwarze@

Revision 1.31 / (download) - annotate - [select for diffs], Thu Aug 28 07:53:07 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.30: +2 -5 lines
Diff to previous 1.30 (colored)

Simplify.

Revision 1.30 / (download) - annotate - [select for diffs], Thu Aug 28 06:52:57 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.29: +5 -5 lines
Diff to previous 1.29 (colored)

Consistency in conditionals; no functional change.

Revision 1.29 / (download) - annotate - [select for diffs], Wed Aug 27 23:50:45 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +9 -13 lines
Diff to previous 1.28 (colored)

Disentangle svc_default_enabled_flags() and svc_get_flags().
This saves three expensive function calls in svc_default_enabled_flags(),
two to _rc_parse_conf() and one to svc_get_flags().  No functional change.
Feedback and ok ajacoutot@.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Aug 26 22:39:09 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.27: +17 -38 lines
Diff to previous 1.27 (colored)

Simplify the function add_flags().
Do not validate input twice, scrap needless array, and avoid needless
expensive function calls to svc_get_flags(), svc_default_enabled_flags(),
_rc_parse_conf(), and resolve code duplication.  No functional change.
Feedback and OK ajacoutot@.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Aug 25 23:15:37 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +13 -9 lines
Diff to previous 1.26 (colored)

Base system special services have no flags, so move the test for them
up front in add_flags().  This avoids unnecessary work, avoids setting
bogus variables, and reduces the risk of screwing up things when changing
the code.  No functional change right now.
ok ajacoutot@

Revision 1.26 / (download) - annotate - [select for diffs], Mon Aug 25 21:34:34 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +4 -6 lines
Diff to previous 1.25 (colored)

get rid of the tempfile in svc_default_enabled_flags();
feedback and ok ajacoutot@

Revision 1.25 / (download) - annotate - [select for diffs], Mon Aug 25 21:06:46 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.24: +9 -2 lines
Diff to previous 1.24 (colored)

rc.d scripts are shell scripts and need to be sourced in svc_get_flags().
It's the only way to get daemon_flags in case it contains line
continuation... We only need to do that for enable package scripts.

original idea from Sebastien Marie
discussed with, input from and ok schwarze@

Revision 1.24 / (download) - annotate - [select for diffs], Mon Aug 25 19:01:26 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.23: +6 -7 lines
Diff to previous 1.23 (colored)

For functions that take args, return immediately if no args is passed.
Add/drop missing/unused local variables.

no functionnal change

Revision 1.23 / (download) - annotate - [select for diffs], Mon Aug 25 18:50:22 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.22: +47 -31 lines
Diff to previous 1.22 (colored)

Cope with some weird rc.conf.local file like "foobar" in pkg_scripts
while "foobar_flags" is set to "NO"...
Reparse deamon_flags at the end of add_flags() since they may have been
modified by the function.

Revision 1.22 / (download) - annotate - [select for diffs], Mon Aug 25 14:29:18 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.21: +4 -14 lines
Diff to previous 1.21 (colored)

Simplify rm_from_pkg_scripts(); minus ten lines; no functional change;
ok ajacoutot@.

For non-trivial automated text editing in sh(1), thou shalt use sed(1).

Revision 1.21 / (download) - annotate - [select for diffs], Mon Aug 25 07:35:37 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.20: +3 -2 lines
Diff to previous 1.20 (colored)

Display usage on 2 lines.

reworked from an original diff by schwarze@

Revision 1.20 / (download) - annotate - [select for diffs], Sun Aug 24 19:44:02 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +11 -23 lines
Diff to previous 1.19 (colored)

Delete the function svc_get_all().
In svc_is_avail(), this simplifies the code by getting rid of the loop.
When running "rcctl status", this allows to not run svc_is_special() -
which spawns a grep - for each and every service, resulting in a 20%
speedup.  As a bonus, we get the special services listed at the end,
where they are easier to see than mixed in with the daemons.
ok ajacoutot@ jasper@

Revision 1.19 / (download) - annotate - [select for diffs], Sun Aug 24 19:00:46 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +7 -4 lines
Diff to previous 1.18 (colored)

Whitelisting allowed services is safer and less confusing than
blacklisting auxiliary variables, and it makes the coupling
to rc.subr(8) less tight.
Feedback and OK ajacoutot@.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Aug 24 18:10:26 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +6 -6 lines
Diff to previous 1.17 (colored)

Start all error messages with "rcctl: " such that it is clear where
they come from.  While here, there is no need to check the argument
of needs_root() before displaying it, it is always provided.
ok ajacoutot@ jasper@

Revision 1.17 / (download) - annotate - [select for diffs], Sun Aug 24 17:52:38 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.16: +2 -1 lines
Diff to previous 1.16 (colored)

Add a comment to unconfuse Ingo :-)

Revision 1.16 / (download) - annotate - [select for diffs], Sun Aug 24 17:01:44 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.15: +1 -5 lines
Diff to previous 1.15 (colored)

Drop obvious comments.

Revision 1.15 / (download) - annotate - [select for diffs], Sun Aug 24 13:46:57 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.14: +48 -48 lines
Diff to previous 1.14 (colored)

reduce indentation of main program by one tab, no functional change
ok ajacoutot@

Revision 1.14 / (download) - annotate - [select for diffs], Sun Aug 24 08:13:15 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

Fix args to needs_root() when using "disable" (broken in the v1.9
positional args cleanup commit).

from Sebastien Marie

Revision 1.13 / (download) - annotate - [select for diffs], Sun Aug 24 07:46:54 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.12: +2 -1 lines
Diff to previous 1.12 (colored)

Since rcctl(8) can changes the position of such and such variable, sort
the file so that we always have a consistent output.

ok schwarze@ jasper@

Revision 1.12 / (download) - annotate - [select for diffs], Sun Aug 24 07:33:26 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.11: +13 -3 lines
Diff to previous 1.11 (colored)

Make it possible to pass `-d' and `-f' to the rc.d(8) script.

man page bits from schwarze@
ok jasper@ schwarze@

Revision 1.11 / (download) - annotate - [select for diffs], Thu Aug 21 14:26:16 2014 UTC (9 years, 9 months ago) by jsg
Branch: MAIN
Changes since 1.10: +2 -0 lines
Diff to previous 1.10 (colored)

add $OpenBSD$

Revision 1.10 / (download) - annotate - [select for diffs], Thu Aug 21 12:47:22 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.9: +3 -4 lines
Diff to previous 1.9 (colored)

Make "rcctl status" output match rc.conf(8) format.

ok jasper@

Revision 1.9 / (download) - annotate - [select for diffs], Thu Aug 21 08:54:58 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.8: +0 -1 lines
Diff to previous 1.8 (colored)

If a service is disabled its flags are unconditionally set to "NO", so
there's not need to display "enabled" or "disabled" when calling "status",
we have the information already.

Revision 1.8 / (download) - annotate - [select for diffs], Wed Aug 20 17:15:17 2014 UTC (9 years, 9 months ago) by rpe
Branch: MAIN
Changes since 1.7: +27 -22 lines
Diff to previous 1.7 (colored)

Store the positional args in vars with meaningful names which makes the arg
checking block easier to comprehend.

OK ajacoutot@

Revision 1.7 / (download) - annotate - [select for diffs], Wed Aug 20 15:04:14 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.6: +17 -44 lines
Diff to previous 1.6 (colored)

Greatly simplify get/set flags and status.

Provide a unified output for the status of disabled services/daemons:
foobar_flags will always be "NO" regardless of the type (pkg script,
base system daemon, special variable).

Revision 1.6 / (download) - annotate - [select for diffs], Wed Aug 20 13:23:56 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.5: +27 -4 lines
Diff to previous 1.5 (colored)

Drop default values from rc.conf.local when we run "enable".

Revision 1.5 / (download) - annotate - [select for diffs], Wed Aug 20 07:55:45 2014 UTC (9 years, 9 months ago) by rpointel
Branch: MAIN
Changes since 1.4: +12 -6 lines
Diff to previous 1.4 (colored)

unify the declaration of functions.
ok aja@

Revision 1.4 / (download) - annotate - [select for diffs], Tue Aug 19 17:51:05 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.3: +1 -1 lines
Diff to previous 1.3 (colored)

Sync usage.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Aug 19 16:47:18 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.2: +11 -11 lines
Diff to previous 1.2 (colored)

Simplify some checks
Return immediatly from add_flags() if we are already enabled and no flags
are (re)set; unbreak "enable" under some circumstances.

Revision 1.2 / (download) - annotate - [select for diffs], Tue Aug 19 15:26:18 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN
Changes since 1.1: +0 -6 lines
Diff to previous 1.1 (colored)

Drop commented code.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Aug 19 14:08:20 2014 UTC (9 years, 9 months ago) by ajacoutot
Branch: MAIN

Introduce rcctl(8), a simple utility for maintaining rc.conf.local(8).

# rcctl
usage: rcctl enable|disable|status|action [service [flags [...]]]

Lots of man page improvement from the usual suspects (jmc@ and schwarze@)
not hooked up yet but committing now so work can continue in-tree
agreed by several

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.