aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/etc/rc.common
Commit message (Collapse)AuthorAgeFilesLines
* base-files: add service_stopped as a post stop hookArthur Skowronek2019-05-051-0/+3
| | | | | | | | | | | | | | | | | | | | Purpose of these changes is to introduce a hook for post service shutdown in a similar fashion to the existing hook service_started. I found it to be useful to specify a hook that is called once the service has been stopped and not before the service is stopped like the stop_service hook does. The concrete use case I have for this is that I'm running a binary that takes over the hardware watchdog timer. Said binary unfortunately can not use ubus directly to tell procd to hand over the watchdog timer so this has to be done in the service file for the binary in question. In order to support a clean handover of the watchdog timer back to procd, the service init script has to dispatch the ubus invocation once the binary in question has been stopped. Signed-off-by: Arthur Skowronek <ags@digineo.de> Signed-off-by: Petr Štetiar <ynezz@true.cz> [added commit message, use the same form as other hooks]
* base-files: fix unkillable processes after restartLinus Kardell2018-11-221-0/+1
| | | | | | | | | | | | | | | When restart is run on an init script, the script traps SIGTERM. This is done as a workaround for scripts named the same name as the program they start. In that case, the init script process will have the same name as the program process, and so when the init script runs killall, it will kill itself. So SIGTERM is trapped to make the init script unkillable. However, the trap is retained when the init script runs start, and thus processes started by restart will not respond to SIGTERM, and will thus be unkillable unless you use SIGKILL. This fixes that by removing the trap before running start. Signed-off-by: Linus Kardell <linus@telliq.com>
* base-files: protect stop and reload actions with procd_lockRoman Yeryomin2018-01-021-0/+2
| | | | | Signed-off-by: Roman Yeryomin <roman@advem.lv> Signed-off-by: Andrejs Hanins <ahanins@gmail.com>
* base-files: rc.common: fix enable() return code and logicRoman Yeryomin2018-01-021-7/+8
| | | | | | | | | | | | | | | In current state, if there is START but no STOP, enbale() will return 1 (failure), which is wrong. Moreover there is no need to check for START/STOP twice. Instead, add err variable to save success state and and return it's value. Also eliminate the need to disable() by using 'ln -sf', which will first delete the old symlink if one exists. Changes from v1: - fixed description Signed-off-by: Roman Yeryomin <roman@advem.lv>
* procd: service_data: Support data within the service itselfPierre Lebleu2017-11-101-0/+4
| | | | | | Use the same approach than the service_triggers for the service_data. Signed-off-by: Pierre Lebleu <pme.lebleu@gmail.com>
* base-files: fix default procd reloadAlexandru Ardelean2017-05-201-1/+1
| | | | | | | | | | | | | | | | | | Bug introduced with 6713694. I did not count on procd handling reload as mentioned in this doc: https://wiki.openwrt.org/inbox/procd-init-scripts ``` procd_set_param file /var/etc/your_service.conf # /etc/init.d/your_service reload will restart the daemon if these files have changed procd_set_param netdev dev # likewise, except if dev's ifindex changes. procd_set_param data name=value ... # likewise, except if this data changes. ``` The service would be restarted regardless of any of those params. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* base-files: use restart if no reload hook for serviceAlexandru Ardelean2017-04-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | This was also working before, with a slightly different semantic. [ Original semantic ] If no reload hooks was implemented, the default one would kick in, it would return fail, and restart would happen. This would happen also in the case where a reload hook would be implemented, it would fail, and it would restart the service. [ New semantic ] The default reload hook calls restart. Services can implement their own reload. If reload fails, then the '/etc/init.d/<service> reload' would return a non-zero code, and the caller can choose a way to handle this. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* procd: Allow initscripts to start one daemon instance at a timePierre Lebleu2016-10-181-1/+3
| | | | Signed-off-by: Pierre Lebleu <pierre.lebleu@technicolor.com>
* base-files: add a init.d option that will start the syscall tracerJohn Crispin2015-03-261-1/+6
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 45009
* rc.common: when reloading a service using procd, fall back to calling start ↵Felix Fietkau2014-07-031-1/+1
| | | | | | | | | | instead of restart This avoids unnecessary service restarts Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 41490
* base-files: add a post start hook to the procd init.d apiJohn Crispin2014-06-261-0/+3
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 41344
* base-files: calling stop_service before procd_kill.John Crispin2014-06-021-1/+1
| | | | | | | | | | | | Before this patch, doing `/e/c/network restart' will emit the folloing error by `ubus network.wireless down "{}"' because netifd already quit by that time. Command failed: not found Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> SVN-Revision: 40906
* base-files: remove duplicate stop_service() function.Felix Fietkau2014-04-271-4/+0
| | | | | | | | | It was introduced in commit 2f966e8, "base-files: add a post start hook for procd managed services". Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> SVN-Revision: 40576
* base-files: add a post start hook for procd managed servicesJohn Crispin2013-09-171-1/+20
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 38024
* procd: add a small script that handles config reloads until configd is readyJohn Crispin2013-07-111-0/+4
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37248
* base-files: run readlink on initscript name before opening servicesJohn Crispin2013-07-111-3/+3
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37241
* base-files: add basic procd integration, let procd start (and restart) ubus ↵Felix Fietkau2012-12-221-0/+31
| | | | | | instead of having an ubus init script SVN-Revision: 34866
* base-files: enable shell tracing in initscripts when INIT_TRACE is setJo-Philipp Wich2012-06-131-1/+3
| | | | SVN-Revision: 32340
* base-files: split service related functions off to /lib/functions/service.shFelix Fietkau2012-03-201-1/+2
| | | | SVN-Revision: 31042
* package/base-files: move service* functions from /etc/rc.common to ↵Nicolas Thill2011-11-081-82/+0
| | | | | | /lib/functions.sh SVN-Revision: 28864
* package/base-files: /etc/rc.common: add service wrapper around start-stop-daemonNicolas Thill2011-11-071-1/+83
| | | | SVN-Revision: 28834
* base-files: warn when calling /etc/init.d/<script> enable and neither START ↵Felix Fietkau2011-07-271-0/+4
| | | | | | nor STOP is defined SVN-Revision: 27797
* base-files: use shutdown instead of stop when the system goes down (patch by ↵Felix Fietkau2010-12-131-1/+1
| | | | | | tripolar) SVN-Revision: 24540
* base-files: fix shell syntax (prevent error messages when activating ↵Nicolas Thill2010-03-291-1/+1
| | | | | | initscripts in IB) SVN-Revision: 20571
* simplify action handling in rc.common (#5558)Florian Fainelli2009-07-261-23/+9
| | | | SVN-Revision: 17012
* make links to statup scripts in /etc/rc.d relativeNicolas Thill2008-09-231-2/+2
| | | | SVN-Revision: 12659
* missing optional parameters for restart and boot functionsFelix Fietkau2008-01-251-3/+3
| | | | | | | | | | Add missing optional parameters in remaining rc functions. It fixes my previous implementation of parametrized rc functions [8106], ticket #3063, thanks argovela-at-yahoo-com for reporting. Signed-off-by: Lubos Stanek (lubek) <lubek@lubek.name> SVN-Revision: 10245
* add patch from #2111Felix Fietkau2007-07-221-11/+13
| | | | SVN-Revision: 8106
* fix typoMike Baker2007-05-101-1/+1
| | | | SVN-Revision: 7170
* START/STOP values must be specified in the init scriptMike Baker2007-05-101-4/+3
| | | | SVN-Revision: 7164
* add K* scripts to be run at shutdownMike Baker2007-05-101-0/+1
| | | | SVN-Revision: 7163
* add a workaround for self-killing init scripts on restart (#1023)Felix Fietkau2006-12-201-0/+1
| | | | SVN-Revision: 5876
* add a check to see if an init script is enabledFelix Fietkau2006-12-081-0/+6
| | | | SVN-Revision: 5727
* rename default/ to files/Felix Fietkau2006-11-221-0/+83
SVN-Revision: 5622