aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/procd/files/procd.sh
Commit message (Collapse)AuthorAgeFilesLines
* procd: allow optional watchdog instance parameterDaniel Bailey2020-07-141-2/+2
| | | | | | | | | | | | | | Optional instance watchdog timeout and watchdog mode can be set by adding: procd_set_param $mode $timeout $mode is an integer [0-1] representing instance watchdog mode of operation: 0 = disabled 1 = passive mode, client must periodically poke watchdog via ubus $timeout is an integer representing how often, in seconds, the watchdog must be poked. Signed-off-by: Daniel Bailey <danielb@meshplusplus.com>
* procd: jail: fix segfault and add console featureDaniel Golle2020-05-151-0/+1
| | | | | | | | 2e73848 jail: SIGSEGV must not be forwarded to the child process 7e150f6 jail: unnamed jails can not have netns (fix segfault) 1ab539b jail: add option to provide /dev/console to containers Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* procd: replace backticks by $(...)Adrian Schmutzler2020-05-131-2/+2
| | | | | | This replaces deprecated backticks by more versatile $(...) syntax. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* procd: bump to latest HEADDaniel Golle2020-04-091-1/+4
| | | | | | | | | | | | 2188d81 jail: add support for launching extroot containers 6f3dbd2 jail: add support for userns and cgroupsns 28a06e5 jail: add support for (ram-)overlayfs Add handling for extroot, overlaydir and tmpoverlaysize as well as jail flags for userns and cgroupsns to OpenWrt's shell script to allow their use in init scripts. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* procd: actually wire-up netns supportDaniel Golle2020-03-121-0/+1
| | | | | | | | When support for network namespaces was added to procd, adding the corresponding jail flag in procd.sh was ommitted. Add it now. Fixes: 97a03a4760 ("procd: update to latest git HEAD") Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* procd: support 'requirejail' attributeKevin Darbyshire-Bryant2020-02-041-0/+1
| | | | | | | | | | | | | | | | Bump procd package to reduce log spam related to missing jail binaries in a non-jail capable system. bcb8655 instance: add 'requirejail' attribute An additional jail attribute 'requirejail' can now be used to indicate mandatory use of a jailed environment and hence prevent process startup in the event that the jail subsystem is unavailable. Procd will now only log errors if jail is unavailable and 1) is a mandatory requirement or 2) a procd debug level of at least 2 is in use. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* procd: allow usage of * as procd_running() instance parameterAlin Nastac2019-10-181-3/+3
| | | | | | | | | | | service_running() implementation in /etc/rc.common use it. It is preferable to use wildcard than assuming the instance name is the default one. jsonfilter returns all matches when wildcards are used, hence the -l 1 argument used to limit output to only one value. Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
* procd: fix invalid JSON filter expression in procd_running()Jo-Philipp Wich2019-09-191-1/+1
| | | | | | | | | Since service and instance names may contain characters which are not allowed in JSON path labels, such as dashes or spaces, change the filter expression to array square bracket notation to properly match these cases as well. Fixes: 2c3dd70741 ("procd: add procd_running() helper for checking running state") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files,procd: add generic service statusLuiz Angelo Daros de Luca2019-09-151-0/+25
| | | | | | | | | | | | | | Adds a default status action for init.d scripts. procd "service status" will return: 0) for loaded services (even if disabled by conf or dead) 3) for inactive services 4) when filtering a non-existing instance Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com> [rebased, cleaned up] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* procd: add procd_running() helper for checking running stateRafał Miłecki2019-05-021-0/+15
| | | | | | | | This should be helpful for implementing service_running() in procd init scripts. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: John Crispin <john@phrozen.org>
* procd: allow passing optional group instance parameterMichael Heimpold2019-05-021-2/+3
| | | | | | | | | Sometimes is desirable to run a process with a specific group id instead of the default one which is derived from passwd entry. This can be achived now by using procd_set_param group $mygroup. Signed-off-by: Michael Heimpold <mhei@heimpold.de> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_SOURCE_VERSION update]
* procd: allow passing optional syslog facility as instance parameterMichael Heimpold2019-05-021-1/+4
| | | | | | | | | Optional syslog facility can be set by adding procd_set_param facility $myfacility. While at, also add stdout/stderr documentation. Signed-off-by: Michael Heimpold <mhei@heimpold.de> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_SOURCE_VERSION update]
* procd: Add wrapper for uci_validate_section()Jeffery To2019-01-221-0/+17
| | | | | | | | | | | | | | | | | This adds a wrapper (uci_load_validate) for uci_validate_section() that allows callers (through a callback function) to access the values set by uci_validate_section(), without having to manually declare a (potentially long) list of local variables. The callback function receives two arguments when called, the config section name and the return value of uci_validate_section(). If no callback function is given, then the wrapper exits with the value returned by uci_validate_section(). This also updates several init scripts to use the new wrapper function. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* procd: fix procd_lock() when prepare_roofsYousong Zhou2018-01-281-2/+2
| | | | | | | | | | | | This fixes the following errors when doing "make package/install" /home/yousong/git-repo/lede-project/lede/build_dir/target-mips_24kc_musl/root-malta/lib/functions/procd.sh: line 47: /home/yousong/git-repo/l ede-project/lede/build_dir/target-mips_24kc_musl/root-malta/var/lock/procd_urandom_seed.lock: No such file or directory flock: 1000: Bad file descriptor Fixes FS#1260 Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* procd: procd_send_signal use signal namesKevin Darbyshire-Bryant2018-01-021-0/+4
| | | | | | | | | | | Usage documentation for 'procd_send_signal' states "The signal is SIGHUP by default, and must be specified by NAME." Make actual behaviour match the stated documented behaviour. https://wiki.openwrt.org/inbox/procd-init-scripts Suggested-by: Jo-Philip Wich <jow@mein.io> Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* procd: introduce procd_lock for init script protectionRoman Yeryomin2018-01-021-0/+15
| | | | | | | | | Use flock to protect init script from concurrent execution (of the same script). Important for services which generate native config files. Signed-off-by: Roman Yeryomin <roman@advem.lv> Signed-off-by: Andrejs Hanins <ahanins@gmail.com>
* procd: service_data: Support data within the service itselfPierre Lebleu2017-11-101-0/+15
| | | | | | Use the same approach than the service_triggers for the service_data. Signed-off-by: Pierre Lebleu <pme.lebleu@gmail.com>
* procd: mdns: Support txt values with spacesKarl Palsson2017-09-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Properly quote the arguments so that you can register a service with TXT entries that contains spaces. Example: procd_add_mdns myservice tcp 9999 "key=descriptive text field 1" \ "another=something equally verbose" Output before: $ avahi-browse -r -v _myservice._tcp _myservice._tcp local hostname = [blah.local] address = [192.168.255.74] port = [9999] txt = ["verbose" "equally" "another=something" "1" "field" "text" "key=descriptive"] Output now: $ avahi-browse -r -v _myservice._tcp _myservice._tcp local hostname = [blah.local] address = [192.168.255.74] port = [9999] txt = ["another=something equally verbose" "key=descriptive text field 1"] Signed-off-by: Karl Palsson <karlp@etactica.com>
* procd: support term_timeout parameterJo-Philipp Wich2017-06-261-1/+1
| | | | | | | | | Expose "term_timeout" parameter in procd.sh to allow init scripts to request a longer termination timeout. This is required to fix FS#859 in a later commit. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* procd.sh: use parameterized respawn valuesClaudiu Brasovean2017-03-071-1/+3
| | | | | | | | | | continue work started here: http://patchwork.ozlabs.org/patch/520859 Extend /etc/config/system with parameters to set the default respawn treshold and respawn timeout for procd launched services that have respawn enabled. This results in cleaner init scripts, while making sure services have respawn parameters set. Signed-off-by: Claudiu Brasovean <cbrasho@gmail.com>
* procd: fix default timeout for reload trigger actionsDenis Osvald2017-02-151-5/+2
| | | | | | | | | | | | | Default trigger action timeout was added to procd.sh in commit f88e3a4c0 (procd: add default timeout for reload trigger actions) However, the timeout value was not placed under the correct JSON-script array nesting level and thus did not apply. To fix this and make the timeout actually apply to the reload triggers, we place it in the correct scope, that is the per-trigger array. Fixes: f88e3a4c0abb60bb76a7678dd30dfdc8a808a2f1 Signed-off-by: Denis Osvald <denis.osvald@sartura.hr>
* procd: update procd.sh to disallow signal-numbers, enforce signal-namesBastian Bittorf2017-01-261-1/+4
| | | | | | | | | | | | A given signal-name is now converted to the corresonding number. In general it's good style to use names (readability) and it's more portable: signal numbers can be architecture-dependent, so we are more safe giving names. A real world example is signal 10, which is BUS on ramips and USR1 on PPC. All users of 'procd_send_signal' must change their code to reflect this. Signed-off-by: Bastian Bittorf <bb@npl.de>
* procd: update procd.sh to support sending kill signal to a serviceHans Dedecker2016-12-201-1/+17
| | | | | | | | Add procd_send_signal which allows to send an optional specified kill signal to one specified or all instances of a given service. By default SIGHUP is sent if no signal is specified Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* procd: add support for service signalsJo-Philipp Wich2016-12-141-1/+1
| | | | | | | | | | | | | | | | Update procd to latest HEAD in order to introduce support for services signals: - Adds a new service.signal ubus call to send a kill() signal to one or all running instances of a given service - Adds a new "reload_signal" property which allows service init scripts to request procd to send a specific kill() signal on reload, instead of stopping and restarting running processes Also fixes some potential memory leaks reported by cppcheck and an environment variable corruption in the trace command. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* procd: Allow initscripts to start one daemon instance at a timePierre Lebleu2016-10-181-1/+1
| | | | Signed-off-by: Pierre Lebleu <pierre.lebleu@technicolor.com>
* procd: add default timeout for reload trigger actionsFelix Fietkau2016-07-291-0/+10
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* procd: rework trigger handlingFelix Fietkau2016-07-291-8/+16
| | | | | | | | | Open/close triggers array around service_triggers call to make using multiple triggers easier to deal with. The API was quite confusing, because some functions contained implicit trigger open/close calls and some didn't. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* procd: fix respawn related warningJohn Crispin2016-03-101-0/+1
| | | | | | | | WARNING: Variable 'respawn' does not exist or is not an array/object Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 48996
* procd: support pidfile writing.John Crispin2016-03-101-1/+2
| | | | | | | | | | | | procd from revision b12bb150ed38a4409bef5127c77b060ee616b860 supports writing a pidfile. This adds support for setting that parameter with standard init script hooks: procd_set_param pidfile /var/run/someprocess.pid Signed-off-by: Karl Palsson <karlp@etactica.com> SVN-Revision: 48984
* procd: Allow to configure default respawn retry countJohn Crispin2016-03-041-0/+10
| | | | | | | | | | | | | | | | | | Extend /etc/config/system with a parameter to set the default respawn retry for procd launched services that have respawn enabled. config service option respawn_retry -1 All services that don't specify specific respawn parameters will get their defaults added by procd.sh. If respawn_retry is specified in /etc/config/system the default retry limit will be set to this value by procd. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> SVN-Revision: 48915
* procd: update procd.sh to support new ujail optionsJohn Crispin2015-12-111-3/+3
| | | | | | Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com> SVN-Revision: 47862
* procd: correct the order of respawn params in the comments.Felix Fietkau2015-06-141-1/+1
| | | | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> SVN-Revision: 45955
* procd: work around a event raceJohn Crispin2015-06-031-2/+0
| | | | | | | | | | there is a conceptual design flaw in our interface events. workaround this by disabling duplicate message supression in procd. we need to fix this properly for the next release Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 45883
* procd: add a 10 second delay to the interface triggersJohn Crispin2015-06-021-0/+1
| | | | | | | | | this is an ugly hack that will be removed when the netifd maintainers have time to look at the problem. Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 45876
* Removed reference to imaginary procd_add_interface_reload in procd.shJohn Crispin2015-04-181-1/+0
| | | | | | | | | The last line of procd.sh has a reference to procd_add_interface_reload. procd_add_interface_reload doesn't seem to exist. I've removed the reference of it to minimize confusion. Signed-off-by: Eric Schultz <eschultz@prplfoundation.org> SVN-Revision: 45487
* procd: add jail supportJohn Crispin2015-03-261-1/+59
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 45010
* procd: add support for relaying daemon stdio to syslogJo-Philipp Wich2015-02-261-0/+3
| | | | | | | | | | | | | Procd enabled init scripts can now specify: procd_set_param stdout 1 procd_set_param stderr 1 ... to relay their respective standard IO streams to the system log. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 44547
* scripts: fix wrong usage of '==' operatorJohn Crispin2014-10-141-1/+1
| | | | | | | | | | | | | | [base-files] shell-scripting: fix wrong usage of '==' operator normally the '==' is used for invoking a regex parser and is a bashism. all of the fixes just want to compare a string. the used busybox-ash will silently "ignore" this mistake, but make it portable/clean at least. this patch does not change the behavior/logic of the scripts. Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com> SVN-Revision: 42911
* procd: update to latest gitJohn Crispin2014-09-111-0/+4
| | | | | | | | add support for starting services as !root Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42471
* procd: allow adding empty strings to arraysFelix Fietkau2014-09-101-1/+1
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 42456
* procd: run the mdns register outside the sub shell containerJohn Crispin2014-08-291-3/+2
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42327
* procd: update to latest git HEADJohn Crispin2014-08-291-0/+44
| | | | | | | | this adds a interafce.update trigger and mdns service registration helpers Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42324
* procd: add a shell helper function to emit a config.change eventFelix Fietkau2014-07-021-0/+13
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 41482
* procd: add shell functions to add instance dataFelix Fietkau2014-07-021-0/+11
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 41481
* procd: fix uci_validationJohn Crispin2014-06-301-1/+2
| | | | | | | | | | Regardles of the return code from validate_data _error variable will be 0 due to 'local' command in the previous line. With this patch we are able to catch the return code from validate_data tool. Signed-off-by: Luka Perkov <luka@openwrt.org> SVN-Revision: 41414
* procd: rename procd_add_network_triggerJohn Crispin2014-06-161-3/+4
| | | | | | | | i got complaints about the bad naming of the api. lets rename it while there are no users yet. Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 41220
* procd: allow passing multiple config files to procd_add_reload_triggerFelix Fietkau2014-06-111-1/+4
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 41146
* procd: service instances can now report an error of why they failed to start.John Crispin2014-06-061-0/+13
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 41031
* procd: add wrapper calls for interface triggersJohn Crispin2014-06-051-2/+35
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 41008
* procd: rename local variable in uci_validate_sectionJohn Crispin2014-06-051-9/+9
| | | | | | | | | | | | | | Allow to use "package", "type", "name", "error" and "result" as config option names: package some_service config section 'foo' option name 'bar' option type 'unknown' Signed-off-by: Maxim Storchak <m.storchak@gmail.com> SVN-Revision: 41006