Add support for monitoring environment files for services declared with
the `env:[-]/path/to/file` option. The default path to such files has
been chosen to follow Debian and Buildroot /etc/default/*
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Use iwatch, modeled after pidfile plugin
- Use one .conf watcher for all *.conf paths/files
- Use full path of conf file for changes, from realpath().
This fixes a long-standing limitation on unique filenames
for services, that absolutely nobody knew about
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
We don't want to show progress (starting/stopping/restaring) at
runtime, since Finit v3. Many systems hooked up to a console
get confused by sudden output, or even ansi escape sequences.
This patch drops code added recently which caused a regression
in this policy. The resulting code is even more readable.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch handles a corner case when Finit may not have detected a
supervised process has died. When a user calls `initctl restart foo`
we now send such lost PIDs to the service_monitor() for restart.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Really kill them, our monitored process may be about to restart, so we
don't want any unintended side effects from lingering children in prior
instances.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch fixes a long standing issue where removing a service from
/etc/finit.conf does not stop and unregister it. The issue was caused
by the Finit support for "protected" services, e.g. services created
by plugins like hotplug.so
To reproduce issue before this fix:
cat /etc/finit.d/available/ntpd.conf >> /etc/finit.conf
initctl reload
The NTP service now runs smoothly, as expected. Later on, we decide to
drop it from our system:
sed -i 1,2d /etc/finit.conf
initctl reload
... and the NTP service continues to run unaffected. Not what most sane
users expect.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The cond_reload() fn is called on `initctl reload`, thus we don't need
to call service_step(), since we call service_step_all() later in that
cycle. So we can drop cond_update(NULL), which calls service_step().
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
With the redesign from <svc/path/to/pidfile> to <pid/name:id> in d1fac6f
we moved to matching svc_t only against their PID, which could pop up in
any *.pid or */pid in /var/run. This patch drops the (hopefully) last
remnants of the old <svc/> legacy.
To ensure we don't try reading the PID value from socket files, like
/var/run/initctl, we add simple fnmatch() of the inotified file. Two
calls to fnmatch(), for portability reasons, not every system has GNU
libc extensions like FNM_EXTMATCH.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
* test_start_stop_service
Test that we can start/stop (via initctl) a service configured in
finit.conf
* test_start_stop_service_sub_config
Test that we can start/stop (via initctl) a service configured in
finit.d/ files
Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
For now, do not mount /etc as tmpfs, but instead create the dir when
building the rootfs via test/test_root/Makefile.
Signed-off-by: Magnus Malm <magnusmalm@gmail.com>