7cfe6e8458
cleanup: move init specific stuff of init socket to initd
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29 21:00:53 +01:00
028394b8a5
Add service configuration reloading
...
This commit add the ability to initd to reload the service configuration
while running. The new configuration is merged with the existing one as
follows:
For each target:
- If the existing service list is not NULL, we have not started that
target yet. Simply replace it with the new list.
- If it is NULL, the services have already been started.
- First, remove all entries for services in that target that no
loner exist (except from the 'running' list).
- Second, add new services that we don't have yet. Treat them as
recently diseased and let the user start them manualy.
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29 21:00:53 +01:00
ba12700080
Add start/stop commands to init socket
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-28 15:32:10 +01:00
c16735414b
initd: Hand out unique IDs to services
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-28 13:45:33 +01:00
d16d260181
Add filter argument to status request
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-27 17:48:32 +01:00
72c02308cd
Fix: actually process SIGUSR1 in initd
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-25 16:32:45 +01:00
a6c059203b
Fix warnings from gcc 8.3 + musl build
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-20 20:43:41 +01:00
e21840cfce
initd: don't start runsvc for services without exec block
...
First in rdsvc, tag the services that *do* have exec lines, even if we don't
read them.
Second, if a service does not have that flag set, don't try to execute it.
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-20 15:44:14 +01:00
a9602ad6e0
Cleanup status reporting
...
- mimic format of initd
- skip formatting if not a tty
- distinguish exited because failed vs exited because done
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18 18:47:20 +01:00
40ad83dc6a
initd: implement handling of socket requests
...
Actually process requests and send an answer to status inquiries.
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18 18:29:02 +01:00
08f72865b2
Add init socket to initd
...
Create a socket if boot target is done. Close and reopen socket
if SIGUSR1 is received.
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18 14:15:58 +01:00
c544fcc7a3
initd: store completed services in list instead of deleting them
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-15 10:46:11 +01:00
David Oberhollenzer
c14c3c0173
Relicense what is left of the init system under OpenBSD style ISC license
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-23 13:16:08 +01:00
David Oberhollenzer
b864c727c8
Remove unused telinit code
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04 15:33:00 +01:00
David Oberhollenzer
c0e8c7e245
cleanup: let rdline_init open the file
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04 15:02:11 +01:00
David Oberhollenzer
34f542b7cc
Seperate init specific code from utility code
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04 14:30:16 +01:00
David Oberhollenzer
b0b6c68e38
Only enable signals in signalfd that initd actually handles
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-01 00:00:40 +02:00
David Oberhollenzer
066efaa33e
initd: automatically do a shutdown/reboot when the target is completed
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
ec6264bad5
initd: accept sigterm and simply initiate shutdown target
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
25afc0b3d0
Remove ctrl+alt+del target, simply initiate reboot target
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
ec74e5bbee
initd: restructure and merge service supervision code
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
ed23d075ca
Make mksock() more generic, move to util library
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-09 15:32:29 +02:00
David Oberhollenzer
bf63f78b66
Split configuration parser and utility library
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-09 15:32:29 +02:00
David Oberhollenzer
59731dd69b
Add helper program for running services
...
We no longer need to keep entire scripts in init program (i.e. saving space)
and reduce the code and complexity of the init program.
The runsvc tool can later be extended to do more complex child setup, such
as configuring namespaces or seccomp without adding complexity or memory
footprint to init.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-22 13:41:18 +02:00
David Oberhollenzer
720220a3c3
Add flags to selectively skip fields in service files
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-22 13:41:18 +02:00
David Oberhollenzer
2cb64e48fc
Move initd signal setup to platform specific file
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-15 13:24:13 +02:00
David Oberhollenzer
a3437967a2
Rely on PATH variable for running init programs
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-12 12:51:33 +02:00
David Oberhollenzer
55d4a328c9
Read environment for init from config file
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-12 12:05:15 +02:00
David Oberhollenzer
6642b2b2bf
Don't pre-allocate argument vector for command lines
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-11 19:45:26 +02:00
David Oberhollenzer
b81668e045
Minor cleanup
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-07 16:19:38 +02:00
David Oberhollenzer
43274e3910
Remove setup_tty function
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-07 01:33:58 +02:00
David Oberhollenzer
ffb655126a
Create init socket after reaching boot target
...
Filesystem might not be available before then.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-07 01:33:58 +02:00
David Oberhollenzer
04a23330e4
Merge preprocessing of command lines
...
- Common function for splitting string into argument vector
- Preprocess & split command lines while parsing the service file
- Specify "before" and "after" dependencies in a single line
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-04 14:58:01 +02:00
David Oberhollenzer
56e6004336
Simplifiy service file syntax
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-04 14:08:12 +02:00
David Oberhollenzer
160ef94e8b
Add service respawn limit
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-26 00:40:28 +02:00
David Oberhollenzer
09115f9a97
Print status when starting a service marked as respawn
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-25 22:07:33 +02:00
David Oberhollenzer
021f091082
Use services to implement shutdown/reboot sequence
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-25 13:28:07 +02:00
David Oberhollenzer
a71c92b33d
Unify naming of service to shorthand svc
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-25 12:14:06 +02:00
David Oberhollenzer
1b3b98135e
Add license headers and comments to source
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-24 22:50:28 +01:00
David Oberhollenzer
9a88f7da45
Initial commit
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-24 17:04:20 +01:00