Commit Graph

209 Commits

Author SHA1 Message Date
William Hubbs
69f052b611 librc: Complain when a real and virtual service have the same name 2016-01-21 15:58:03 -06:00
William Hubbs
000503fad7 Convert OpenRC to a centralized copyright/license structure
In the past, OpenRC was a hybrid of a centralized and file-scope
license/copyright structure.

I followed the instructions from the Software Freedom Law Center [1] to
convert to a Centralized structure where possible, for easier future
maintenance.

[1] https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html
2015-12-21 12:16:06 -06:00
William Hubbs
b810473e4f man/openrc-run.8: Clarify documentation on dependencies and keywords
Provide an example of using the -containers keyword and clarify
documentation on some of the dependency functions.
2015-12-03 17:37:38 -06:00
William Hubbs
627e925463 add support for -containers keyword 2015-12-03 16:52:15 -06:00
William Hubbs
a0cf8f9124 Add detection for rkt containers 2015-12-02 10:20:39 -06:00
William Hubbs
9fedb3b40b Add detection for docker containers 2015-12-02 10:20:15 -06:00
Ian Stakenvicius
33d3f33b3c Implement "want" dependency
The want dependency is similar to the use dependency. If a service
script, for example called service1, adds "want service2" to its depend
function, OpenRC will attempt to start service2, if it exists on the
system,  when service1 is started.

However, service1 will start regardless of the status of
service2.

X-Gentoo-Bug: 406021
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=406021
2015-11-12 12:32:45 -06:00
William Hubbs
d2ce07e227 Add rc-sstat script
The rc-sstat script is written to display status of s6 services and
run rc-status to display all services status.

This currently only works on Linux.
2015-06-10 18:45:29 -05:00
Mike Gilbert
bcb9c44e73 man: Document the stopsig variable
This variable can be used to set the signal to send if the service is
using start-stop-daemon.

This fixes #56
2015-05-27 14:09:45 -05:00
William Hubbs
b79d058f16 s6: Use s6-svc -Dd to stop services
This allows us to get rid of the sleep call in the stop function. Also,
we set a configurable timeout value for stopping daemons.
2015-05-14 11:40:29 -05:00
William Hubbs
e372f97beb Fix the s6 handling
This changes the default s6 service directory to /var/svc.d, also
it changes the code to work with the individual services instead of
forcing a rescan when a service is started or stopped.
2015-05-13 16:10:08 -05:00
William Hubbs
bb2d7becfd Add support for the s6 supervision suite 2015-05-11 18:36:49 -05:00
William Hubbs
0f9354becf man: Clarify the documentation for command_args
The command_args variable only works if using start-stop-daemon to start
the daemon.
2015-05-11 15:37:30 -05:00
S. Gilles
dff6e4a004 Fix mdoc warning for empty line in rc-update man page.
X-Gentoo-Bug: 529374
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=529374
2014-11-22 11:49:46 -06:00
William Hubbs
8c7ea4e9e8 runscript.sh: add chroot support
This adds support for a chroot variable which will be passed to the
start-stop-daemon --chroot switch to runscript.sh when starting a
daemon. This also needs to be saved so it can be used in locating the
pid file when stopping the daemon.

X-Gentoo-Bug: 524388
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=524388
2014-10-20 15:44:19 -05:00
William Hubbs
20006625a6 man: Document start_inactive and in_background_fake 2014-09-19 17:23:55 -05:00
William Hubbs
40141244e3 man/openrc-run.8: more updates and clarifications for checkpath
X-Gentoo-Bug: 500606
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=500606
2014-07-13 11:23:43 -05:00
Alexander V Vershilov
d59737afb1 man/openrc.8: update checkpath documentation
X-GENTOO-BUG: 500606
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500606
2014-07-13 08:50:36 -05:00
Alexander V Vershilov
f66f41c4f0 typo fix 2014-07-11 16:36:35 -05:00
William Hubbs
23cb55d843 man/start-stop-daemon.8: correct argument from --nice to --nicelevel
X-Gentoo-Bug: 510648
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=510648
2014-06-21 01:53:17 -05:00
Benda Xu
abadaa04ab rc-update: add option to remove a service from all runlevels
The -a option,which only applies to the del command, is used to remove a
service from all runlevels.

X-Gentoo-Bug: 497740
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=497740
2014-01-13 10:41:38 -06:00
William Hubbs
e5a94dd3f4 Add missing documentation for environment variables
Add documentation for the RC_SERVICE, RC_GOINGDOWN, RC_LIBEXECDIR and
RC_NO_UMOUNTS environment variables.

X-Gentoo-Bug: 489344
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=489344
2014-01-08 13:16:27 -06:00
William Hubbs
3470eda3f5 Rename runscript to openrc-run
This was requested by Debian, because the minicom software, which is
available on Debian and other distros, has a binary named runscript. We
are keeping a backward compatibility symlink for now, but this allows
Debian or any other distro to safely remove the symlink.

X-Gentoo-Bug: 494220
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=494220
2013-12-29 22:57:31 -06:00
William Hubbs
7b5fa011ac Rename the rc binary to openrc
Debian requested this rename due to the "rc" binary conflicting with the
"rc" binary from the plan 9 shell.

We also add a deprecation warning to the binary when it is run as rc to
encourage users to switch to openrc instead.

X-Gentoo-Bug: 493958
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=493958
2013-12-12 18:31:29 -06:00
William Hubbs
48981be8a8 Revert "Make einfo routines private"
This reverts commit de88aff0a8.
I was advised that splashutils links to libeinfo, so we do have a
consumer for this library.
2013-10-21 13:49:41 -05:00
William Hubbs
de88aff0a8 Make einfo routines private
The libeinfo library has no consumers other than OpenRC, so there is no
reason for it to be maintained as a library. The einfo routines are now
an object that links with the rc binary.
2013-09-26 22:18:21 -05:00
William Hubbs
2590bf7a2b libeinfo: add separate variable to suppress eerror messages
Add an EERROR_QUIET environment variable which works like EINFO_QUIET
but for the eerror functions. This will allow library consumers to
choose whether to suppress eerror messages separately from einfo and
ewarn messages.

X-Gentoo-Bug: 482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
2013-09-03 13:03:55 -05:00
William Hubbs
a78b18e291 libeinfo: suppress output for eerror* functions
This makes the eerror* functions honor the EINFO_QUIET environment
variable like the einfo* and ewarn* functions.

X-Gentoo-Bug: 482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
2013-08-28 14:23:46 -05:00
William Hubbs
72b58b9e6b Revert "Libeinfo: do not suppress ewarn() messages"
This reverts commit 4ee62c7903.

The previously referenced commit broke consistency because ewarnx() was
respecting the EINFO_QUIET environment setting, but after this commit,
ewarn() was not.
Also, due to discussion on the below referenced bugs, I think we do
want to suppress warnings when EINFO_QUIET=yes.

X-Gentoo-Bug: 482396
X-Gentoo-Bug: 439174
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=439174
2013-08-27 10:26:48 -05:00
William Hubbs
7296379f3f man/runscript.8: minor grammar fixes 2013-08-24 11:57:22 -05:00
William Hubbs
1f5d447eda fix typo on runscript man page
The example code had an invalid checkpath option (--dir instead of
--directory) and a mode that does not make sense for directories (664
instead of 775).

X-Gentoo-Bug: 481034
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=481034
2013-08-15 10:14:42 -05:00
William Hubbs
b2f8ac9382 Clarify the documentation about the restart function
Restart has never been able to be overridden in OpenRc, but there is a
way to make your service script behave differently when restart is being
executed.

X-Gentoo-Bug: 480866
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=480866
2013-08-13 12:12:43 -05:00
William Hubbs
a09a60c4cf Add service applet
The service applet is equivalent to rc-service. This was added so that
we will be more compatible with Debian and Fedora.

Reported-by: cardoe@gentoo.org
X-Gentoo-Bug: 468168
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=468168
2013-05-02 13:52:27 -05:00
William Hubbs
10a4385e40 rc: allow switching runlevels without stopping services
OpenRC, by default, stops all services that are not listed in a runlevel
when rc is used to switch runlevels. This adds a -n/--no-stop command
line option to rc which tells it to skip stopping the services which are
not in the runlevel.

Reported-by: gentoo@thoth.purplefrog.com
X-Gentoo-Bug: 372585
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=372585
2013-04-28 12:51:12 -05:00
William Hubbs
879c7f04ec runscript: update documentation for the provide function
Explain that virtual services take precedence over real services and
recommend that virtual services have different names from real services.

Reported-by: me@2gw.net
X-Gentoo-Bug: 461818
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=461818
2013-03-20 15:42:09 -05:00
Andrew Gregory
06658d1038 fix typo in rc-status.8
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2012-10-21 19:51:09 -05:00
Christian Ruppert
a3ff6cce97 Revert "Prepare for real "restart" support"
This reverts commit c5bb6829d0.

That was meant for my local devel branch :)
2012-10-16 21:28:45 +02:00
Christian Ruppert
c5bb6829d0 Prepare for real "restart" support 2012-10-12 21:07:59 +02:00
William Hubbs
c08b1a6a32 small runscript man page cleanups 2012-09-25 12:09:45 -05:00
William Hubbs
5615fa78d6 Drop restart_pre/restart_post
By design, restart is hard coded to run stop followed by start along
with all of the pre/post functions associated with them. Restart doesn't
need its own pre/post functions since it is possible to make any
function in an init script behave differently for a restart command by
testing against the RC_CMD environment variable.
2012-09-25 10:22:47 -05:00
William Hubbs
f007988fba Clarify how to handle restart processing
The Gentoo developer manual covers how to handle restarts in init
scripts, but this was not officially covered in OpenRc's Documentation.
This commit adds an example to the runscript man page that shows how
this works.
2012-09-23 19:25:57 -05:00
Christian Ruppert
0406c6085b Add restart_pre/restart_post support, also document RC_CMD 2012-09-22 16:57:46 +02:00
William Hubbs
5092595835 add RC_PREFIX environment variable
This will be used by init scripts which want to be able to run in a
Gentoo Prefix installation. RC_PREFIX will contain the prefix offset.
2012-09-09 22:22:15 -05:00
William Hubbs
e641b43849 Bring Back prefix support
We now have a team member who is interested in OpenRC on prefix, so I am
bringing it back to the main tree.
2012-07-26 10:54:48 -05:00
William Hubbs
eb11953dd2 Document the required_dirs and required_files variables 2012-03-24 12:40:45 -05:00
William Hubbs
9fa54a8e80 Runscript: allow extra_commands to be run in chroots
The commands defined in the extra_commands variable do not depend on
whether the service is stopped or started, so it is valid to run them in
chroot environments.

Also, add a note to the runscript man page about the commands in
extra_commands being able to run whether or not the service is started.

Reported-by: Robin Johnson <robbat2@gentoo.org>
X-Gentoo-Bug: 406713
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=406713
2012-03-03 09:22:44 -06:00
William Hubbs
3247184d86 Remove prefix support
I spoke with the prefix team sometime back and was told that they do not
have an interest in using OpenRC on prefix systems.
2012-02-21 07:27:16 -06:00
William Hubbs
47c3b28459 Clarify the documentation about the reboot runlevel
The reboot runlevel does exist, but it gets remapped to the shutdown
runlevel internally.
2012-02-19 13:11:11 -06:00
William Hubbs
f18763bcd8 Document the RC_REBOOT variable 2012-02-19 12:49:53 -06:00
Christian Ruppert
7ea5c614d9 Add -W/--writable function to checkpath
Checkpath -W will use access(3p) to determine whether or not a path is
writable. This is more accurate than test(1p) because it also takes into
account whether or not the filesystem is mounted read-only.

Modified by William Hubbs to add the man page update.
2012-01-26 14:42:18 -06:00
Christian Ruppert
2990e5a2e3 Whitespace 2012-01-22 01:17:42 +01:00
Christian Ruppert
9c0edc5c52 Use the "--make-pidfile" when command_background is used
The start-stop-daemon "--make-pidfile" option is now used by default when using
command_background, this requires a pidfile to be specified.
Document command_background option.

Reported-by: Giampaolo Tomassoni <giampaolo@tomassoni.biz>
X-Gentoo-Bug: 399165
X-Gentoo-Bug-URL: https://bugs.gentoo.org/399165
2012-01-17 18:25:44 +01:00
Christian Ruppert
30a56cdb46 Add "ifstopped" command to runscript
Signed-off-by: Christian Ruppert <idl0r@gentoo.org>
2012-01-15 02:10:35 +01:00
Robin H. Johnson
66f4305e1c rc/checkpath: tmpfiles.d backend creation code
This commit provides the checkpath applet with feature parity to
systemd's tmpfiles.c create_item function.

Very similarly to the systemd function, it does NOT do any of the
cleanup work in this function.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-01-09 19:20:47 -08:00
William Hubbs
1771a83b92 Reword the documentation for the retry option for start-stop-daemon 2011-12-30 22:20:03 -06:00
William Hubbs
e873ef2ba7 Reword retry documentation on runscript man page 2011-12-30 22:12:59 -06:00
Christian Ruppert
26edfe369c Fix the description of --retry in start-stop-daemon(8)
X-Gentoo-Bug: 368615
X-Gentoo-Bug-URL: https://bugs.gentoo.org/368615
Reported-by: Stuart Shelton <srcshelton@gmail.com>
2011-12-31 03:43:25 +01:00
Christian Ruppert
fb8db18d79 Add "retry" option for the stop() template 2011-12-31 02:41:59 +01:00
William Hubbs
810f2e55fb Documentation updates
- Clarify that start_stop_daemon_args is only used when starting a
  daemon.
- fix several typos.
2011-12-30 10:35:16 -06:00
Christian Ruppert
191ea10f86 Document start_stop_daemon_args 2011-12-30 16:03:24 +01:00
William Hubbs
5e01051c4e Allow init scripts to be executed with a relative path
This was a regression that was caused by the fix for
http://bugs.gentoo.org/show_bug.cgi?id=350910. I am reverting the commit
that we said fixed that bug and re-opening it.

Reported-By: Nathaniel <nathaniel@paust.us
X-Gentoo-Bug: 392457
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=392457
2011-12-11 01:18:08 -06:00
Mike Frysinger
ef1ff1b4f2 make shell math operations style more succulent
Convert the style:
	var=$((${var} + 1))
to:
	: $(( var += 1 ))

The latter is easier to read imo.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-19 02:25:36 -05:00
William Hubbs
5b1aaf8cc8 add support for extra_stopped_commands 2011-11-16 13:56:55 -06:00
William Hubbs
4ee62c7903 Libeinfo: do not suppress ewarn() messages
The ewarn() function was affected by the EINFO_QUIET environment
variable which lead to warning messages being suppressed. Warnings
should not be suppressed.

Reported-by: Hanno Boeck <hanno@gentoo.org>
X-Gentoo-Bug: 380073
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=380073
2011-08-22 12:39:26 -05:00
William Hubbs
0c8bea2152 Improve processing of service directories and conf.d files
symbolic links should not be followed in an attempt to work out the name
of the service we are running. Also, @sysconfdir@/conf.d should be tried
as a backup directory for configuration files.

I would like to thank Robin Johnson for his input on this change.

X-Gentoo-Bug: 350910
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=350910
2011-07-31 10:00:48 -05:00
Mike Frysinger
d0bc4f20ad drop useless "All rights reserved" notice
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-06-29 19:46:31 -04:00
William Hubbs
16f7e90c6c clarify documentation for -timeout keyword 2011-04-08 14:08:29 -05:00
Robin H. Johnson
6a0812645a Update manpage for mention of rc_sys purpose.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2011-01-05 22:27:35 -08:00
Robin H. Johnson
6df531d33d Document the order of the services within rc-status output. 2011-01-05 22:09:33 -08:00
Mike Frysinger
ecf9ef49a7 random spelling fixes
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-08 22:02:51 +00:00
Roy Marples
dc3ccd8101 start-stop-daemon can now set process IO scheduling. 2009-12-14 08:47:48 +00:00
Roy Marples
95ee39ab1c Add support for Linux Containers, fixes #202.
Patch by bug reporter.
2009-11-04 19:21:24 +00:00
William Hubbs
c96a015742 fix wait time for gentoo bug 288495
The wait time was in seconds.  This patch converts it to milliseconds.
2009-10-15 20:25:01 +01:00
Roy Marples
44585fea46 Add -P to start-stop-daemon to display a . for each second elapsed.
Fixes #197.
2009-09-04 15:41:08 +01:00
Roy Marples
b4104957b1 We should use -feature instead of nofeature.
This matches the ifconfig and Gentoo USE flag syntax and is hopefully
easier to read.
Fixes #178.
2009-07-01 00:07:32 +01:00
Roy Marples
c09e6b3e6d Typo 2009-05-02 12:31:13 +01:00
Roy Marples
6615eb4b68 Add runlevel stacking, #88
This implementation has the limitation that you cannot have a stacked
runlevel and service of the same name in a runlevel.
2009-05-02 12:26:45 +01:00
Roy Marples
658a220638 Add (c) to Copyright 2009-05-01 15:11:40 +01:00
Roy Marples
fb051bf81a Add -i, --ifexists so that we can do this
rc-sercice -i foo -- restart
instead of this
  rc-service -e foo && rc-service foo -- restart
2009-05-01 08:38:57 +01:00
Roy Marples
f689187966 Add -Z, --dry-run option to show which services we would start/stop
without actually doing so.
Fixes #151.
2009-04-30 23:42:01 +01:00
Roy Marples
b70501ef45 Go back to git 2009-04-30 15:05:39 +01:00
Roy Marples
94b3057571 Add the noshutdown keyword to special case the shutdown. 2009-04-27 12:04:33 +00:00
Roy Marples
eaa32c75c9 Add the nostop keyword so that we don't stop the network init script by default. 2009-04-26 21:16:05 +00:00
Roy Marples
9966a902ab rc-status -c now lists services that have crashed.
It returns 0 if there are crashed services, otherwise 1.
This it easy to restart crashed services automatically.
More for #120.
2009-04-24 10:17:53 +00:00
Roy Marples
953b0b7435 Document -i, --interpreted flag. 2009-04-22 10:49:07 +00:00
Roy Marples
ee53e6ad29 -w, --wait seconds
New option so you can set the number of seconds to wait for and
check the daemon is still running.
The old code that periodically polled wasn't that reliable - in this 
case simpler == better.
Fixes #160
2009-04-19 18:20:49 +00:00
Roy Marples
132dfd7b1e Typo, thanks to Polynomial-C 2009-03-05 00:41:44 +00:00
Roy Marples
70d8c5beda Typo, #150
Thanks to betelgeuse
2009-02-13 12:52:29 +00:00
Roy Marples
abcc4c5c72 Don't allow SYSVINIT parameters through anymore.
RC_REBOOT is now yes when rebooting.
Document the special reboot runlevel.
2009-01-13 11:02:00 +00:00
Roy Marples
3d37005a3d We now warn about clock skews
rc-update -u will force a regen of the dep tree
rc_newer_than and rc_olderthan now take another two parameters for newest/oldest file and mtime
2009-01-12 23:53:13 +00:00
Roy Marples
631acff7aa Document the --chuid option. 2009-01-01 14:32:09 +00:00
Roy Marples
1efa64cae8 Typo. 2008-12-30 19:08:51 +00:00
Roy Marples
38e6c9ba5c make ignore now configures the sv:ignore property. 2008-12-04 12:38:23 +00:00
Roy Marples
03e8e0cb68 More Typos. 2008-11-04 14:28:51 +00:00
Roy Marples
5fc6f21169 Typo 2008-11-04 11:05:30 +00:00
Roy Marples
c520d4a23a --nice is -N, not -n. Also, correct default timeout. 2008-11-03 21:11:29 +00:00
Roy Marples
0af7d5bc20 Add a new shutdown runlevel, Gentoo #224537.
Split halt.sh into halt, killprocs, romount and savecache services.
The reboot runlevel is removed but mapped to shutdown.
The halt script should be moved to the sysvinit package.
2008-11-03 15:31:01 +00:00
Roy Marples
0d98d56188 Remove sysvinit specific code.
The runlevels shutdown, reboot, sysinit and single should be called by
init(8) and shutdown(8) and not manually.
sysvinit users will have to add sulogin to their inittab to secure the
console.
2008-10-27 18:01:03 +00:00
Roy Marples
c3e192a834 Stop ssd from waiting by default - most daemons are good now. 2008-09-26 23:58:57 +00:00
Roy Marples
a63303971a Document the --verbose option. 2008-09-22 09:37:28 +00:00