aboutsummaryrefslogtreecommitdiff
path: root/sh/runscript.sh.in
AgeCommit message (Collapse)Author
2015-03-29Fix rc_verbose processingWilliam Hubbs
We were processing the rc_verbose setting before we sourced the configuration file where it was set; this fixes the issue. Fixes #46
2014-10-20runscript.sh: add chroot supportWilliam Hubbs
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-09-11Use exception-based approach for cgroup/ulimit setupRoy Marples
Note from William Hubbs: I spoke with Roy about this, and he pointed out that user-defined functions may need the limits applied, so it is better to go with a method that uses exceptions to determine which functions apply the limits. X-Gentoo-Bug: 522408 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=522408
2014-09-11runscript: move verbose mode setting near debug settingWilliam Hubbs
2014-07-10Style FixesWilliam Hubbs
2014-07-10cgroups: only run cgroup setup when starting a serviceAlexander V Vershilov
Status call should not set limits as it requires root permissions, also this is not safe, as current process may reach limitation. Solution is to set limits and move process to service cgroup only on start. X-GENTOO-BUG: 500364 X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500364
2013-10-31Fix the service-level rc_verbose settingWilliam Hubbs
This commit fixes the rc_verbose setting so that it is honored if it is set for an individual service. Thanks to whissi@whissi.de for the original patch; this one is slightly modified to be more posix. X-Gentoo-Bug: 489358 X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=489358
2013-09-27fix cgroup_cleanup functionWilliam Hubbs
The yesno test for rc_cgroup_cleanup belongs at the point where this function is called from runscript, not in the function itself. X-Gentoo-Bug: 486210 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=486210
2013-06-25cgroups: add support for systemd cgroup hierarchyWilliam Hubbs
The systemd cgroup hierarchy support is being added so we can run logind outside of systemd. This is needed because software that was using consolekit is now migrating to logind. We do not create this hierarchy, we just add services to it if it exists.
2013-05-25runscript.sh: run cgroup_cleanup automatically after stopWilliam Hubbs
2013-04-25add cgroup cleanup supportAlexander Vershilov
This adds the ability to kill all processes within a service's cgroup when that service is stopped or restarted.
2013-02-16Add module for cgroup processingAlexander Vershilov
sh/rc-cgroup.sh.in: new script to handle cgroup processing sh/rc-cgroup.sh.in: do not use grep or cut (modification by William Hubbs) sh/runscript.sh.in: use the cgroup script
2013-01-15typo fixWilliam Hubbs
2013-01-15runscript: fix stopping changed service issuesWilliam Hubbs
If an init script or service was upgraded while it was running and the settings for the pid file, command and process name were changed, it would not be possible to stop the old service. Runscript now saves the values it used to start the service and re-uses them to stop the service. Reported-by: flameeyes@gentoo.org X-Gentoo-Bug: 434032 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=434032
2012-11-12Support cpu usage management for LinuxAlexander Vershilov
This commit was modified by William Hubbs as follows: - The paths in the cgroup fs were put into variables to ease maintenance. - Documentation was added to rc.conf.Linux. - The services were added originally to openrc/svcname cgroups under the controller cgroups, but this left an "openrc" cgroup which was unused. Now they are added to individual cgroups with the name openrc_${RC_SVCNAME}.
2012-11-07checkbashisms: clean up export statements.Robin H. Johnson
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-09-25Drop restart_pre/restart_postWilliam Hubbs
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-22Add restart_pre/restart_post support, also document RC_CMDChristian Ruppert
2012-04-26fix references to functions.shWilliam Hubbs
There were a couple of places where we were sourcing functions.sh in @SYSCONFDIR@/init.d. This is only a backward compatibility symlink, so it should not be used for openrc. The correct place to source this from is @LIBEXECDIR@/sh.
2012-04-26Change the working directory for depend onlyWilliam Hubbs
We already have a special case for depend processing, so we should change the working directory there only. This prevents us from forcing all init scripts to be run in the init directory.
2012-04-26Revert "Revert "Let runscript enter the service dir before expand globs""William Hubbs
This reverts commit f971c4c0b5e45500f1255f2e076f2c101d2f9281. After further discussion, this is a good first step toward a fix, so I am putting it back.
2012-04-26Revert "Let runscript enter the service dir before expand globs"William Hubbs
This reverts commit 9d0dce35c3e46b4515499f3f0f1c47645be0bc48. This is being reverted due to the fix still being under discussion.
2012-04-26Let runscript enter the service dir before expand globsChristian Ruppert
Enter the service directory, like gendeps.sh does, to make sure globs are expanded in it rather than in /. That makes sure that globbing like "need *" will end up in all files of the init.d directory. Signed-off-by: Christian Ruppert <idl0r@gentoo.org> Reported-by: Guenther Brunthaler <gb_about_gnu@gmx.net> X-Gentoo-Bug: 412677 X-Gentoo-Bug-URL: https://bugs.gentoo.org/412677
2012-03-03Runscript: allow extra_commands to be run in chrootsWilliam Hubbs
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-01-29cgroups: only create the cgroup when the service is being startedWilliam Hubbs
2012-01-28Use "checkpath -W" instead of dir_writable()Christian Ruppert
2012-01-28Check if /sys/fs/cgroup/openrc is writableChristian Ruppert
2012-01-26cgroups: add all services to the openrc cgroupWilliam Hubbs
This is a modified version of a patch originally submitted by Patrick Lauer <patrick@gentoo.org>.
2012-01-22Make checks for writable directory posix compliantWilliam Hubbs
Reported-by: Maxim Kammerer <mk@de.su> X-Gentoo-Bug: 398931 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=398931
2012-01-17drop the extra --pidfile optionWilliam Hubbs
2012-01-17Use the "--make-pidfile" when command_background is usedChristian Ruppert
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
2011-12-31Add "retry" option for the stop() templateChristian Ruppert
2011-12-19cgroups: remove references to the "openrc" cgroupWilliam Hubbs
Openrc will set up cgroups the way the kernel documentation recommends.
2011-12-11Allow init scripts to be executed with a relative pathWilliam Hubbs
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-11-20CGroups: create the openrc cgroup hierarchyWilliam Hubbs
Openrc will create a cgroup hierarchy called openrc which will have all services it starts and all subsystems attached to it. If you need other groups/hierarchies, please use libcgroup.
2011-11-18CGroups: /sys/fs/cgroups should be a tmpfsWilliam Hubbs
The kernel documentation states that a cgroup file system should not be mounted here, but a tmpfs. This also means that we should not create a group for each process, but we should allow the user to specify which group a process should be assigned to. The rc_cgroup variable will be used for this purpose. For more information, see /usr/src/linux/Documentation/cgroups/cgroups.txt.
2011-11-18CGroups: fix group initializationWilliam Hubbs
Make sure cpuset.cpus and cpuset.mems exist in the parent group before attempting to copy them to the new group.
2011-11-17CGroups: finish initializing the CGroupWilliam Hubbs
When a CGroup is created, we need to copy cpuset.cpus and cpuset.mems from the new group's parent into the new group before we can attach any processes to it.
2011-11-17Change RC_CGROUP to lower caseWilliam Hubbs
2011-11-17Add CGroup supportPatrick Lauer
X-Gentoo-Bug: 390297 X-Gentoo-Bug: http://bugs.gentoo.org/show_bug.cgi?id=390297
2011-11-16add support for extra_stopped_commandsWilliam Hubbs
2011-11-02Make sure we load external scripts before using eerrorWilliam Hubbs
Reported-by: Jochen Schlick <josch06@gmail.com> X-Gentoo-Bug: 388715 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=388715
2011-10-16fix random typosMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-09-18runscript: simplify livecd-functions.sh loadingMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-07-31Improve processing of service directories and conf.d filesWilliam Hubbs
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-26Runscript: print deprecation warning for opts variableWilliam Hubbs
Openrc uses the extra_commands and extra_started_commands variables to list extra commands for services. Also, it supports the opts variable which is used to assist migration from baselayout-1. I am adding this warning to encourage switching from opts to extra_commands/extra_started_commands. I would like to remove support for opts eventually.
2011-06-29drop useless "All rights reserved" noticeMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-05-11do not run services if openrc did not boot the systemWilliam Hubbs
X-Gentoo-Bug: 364159 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=364159
2011-01-17more whitespace cleanupMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-12bug 351160: make openrc exit codes LSB compliantEray Aslan
* status on a stopped service now has a return code of 3 (was 1) * starting an already started service now has a return code of 0 (was 1) * stopping an already stopped service now has a return code of 0 (was 1)