Commit Graph
55 Commits
Author SHA1 Message Date
Joachim Wiberg 24a78d3246 Update copyright years and author last name
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-09-02 23:38:11 +02:00
Joachim Nilsson 54e5fd2a78 initctl: Show :ID in process listing(s) only if non-zero
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-04-23 15:14:09 +02:00
Joachim Nilsson f06e17ccc6 initctl: Widen status column a bit to fit 'stopping' state
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-03-05 17:51:52 +01:00
Joachim Nilsson 8d271ac5b8 Fix GCC 9 string trunction warning
- Increase size of resulting path buffer, unlikely a real problem
- Check return value from snprintf() to detect errors and truncation
- Add logit() function wrapper to initctl, maps to _e()/_d()/_pe()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-07 01:03:57 +01:00
Joachim Nilsson 744719219e initctl: Remove experimental cond set/clear commands
The commands are both unsafe (insecure) and send the wrong message,
that initctl can be used to script conditions.  Only plugins are
officially supported to manage conditions.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-07 00:35:13 +01:00
Joachim Nilsson 7bf2fcb6e3 Fix Coverity CID 265222, guard init_request::data member
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-06 23:56:59 +01:00
Joachim Nilsson a5c9d0a3f4 initctl: Fix file descriptor leak, found by Coverity
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-06 22:04:59 +01:00
Joachim Nilsson f51fde4d46 Initial support for cgroups
Similar to how systemd creates cgroups for all services, for purposes of
tracking, Finit now does the same.  We also mount all available cgroups
in the /sys/fs/cgroup namespace.

This patch adds support for grouping processes in logical cgroups, like
systemd, and an `initctl ps` command to list the hieararchy.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-02-05 18:35:36 +01:00
Jonas Johansson f5f1a55747 Add support to specify service ID as a string
Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
2018-12-11 16:43:05 +01:00
Robert Andersson b64dbbf8d0 fix condition string lengths
Signed-off-by: Robert Andersson <robert.m.andersson@se.atlascopco.com>
2018-10-22 12:51:58 +02:00
Robert Andersson f2cab53e55 Add service/task name config option
Allows the service/task name derived from the binary to be
overridden with a custom name.

Example:
    service name:dhcpd [2] /usr/sbin/udhcpd -f -- DHCP Server

Signed-off-by: Robert Andersson <robert.m.andersson@se.atlascopco.com>
2018-10-22 12:51:58 +02:00
Joachim Nilsson 7fdb280712 initctl: Introduce -b[atch] mode for non-interactive use
This patch introduces a new option to initctl; -b, --batch skips
screen_init(), which might otherwise leak ANSI screen resize codes
to the console.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-02-16 10:06:37 +01:00
Joachim Nilsson 84e9569be6 initctl: Adjust field widths in show/status
The job:id field can now be used to display job:INET_PORT_NUMBER, e.g.
100:16161 for job 100 localhost SNMP port 16161.

The service name field has been reduced from 20 --> 16 bytes since the
full path has been reduced to display the basename.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-17 18:42:24 +01:00
Joachim Nilsson 112ab2c22f initctl: Refactor, use struct command rather than command_t
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-04 11:15:55 +01:00
Joachim Nilsson 8fd431f3e9 initctl: Show uptime of running services in show <NAME> output
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-31 18:30:08 +01:00
Joachim Nilsson b26d30757d Document new initctl status <JOB|NAME> command
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-31 17:11:15 +01:00
Joachim Nilsson bb3d9c8670 initctl: Add support for touch <CONF>, mark .conf for reload
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-22 12:50:18 +01:00
Joachim Nilsson db50c09ec5 initctl: Improve show SVC command output a bit, provide summary
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-18 21:04:17 +01:00
Joachim Nilsson c0515d112e New client side API to access svc_t entries without shared memory
This change is one of the required intermediate steps to remove the
shared memory store for all svc_t, this in turn to avoid any external
programs manipulating the internal memory of PID 1.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-18 11:06:19 +01:00
Joachim Nilsson 7362e6d00a initctl: Fix error handling for intictl start/stop if missing arg
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-17 12:12:57 +01:00
Joachim Nilsson d94d11e00a initctl: Allow short forms of commands
For ease of use, allow short forms of commands, like:

   initctl h
   initctl c d
   initctl l

Also, default to show conditions if no argument to cond is given.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-17 12:09:41 +01:00
Joachim Nilsson f06a0fcb71 initctl: Support printing previous runlevel
This patch adds support for "PREVLEVEL RUNLEVEL" output to the initctl
runlevel command.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-17 10:54:06 +01:00
Joachim Nilsson cae61ad6df initctl refactor, break out domain socket/client API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-16 12:15:28 +01:00
Joachim Nilsson fcdb5c2965 initctl: Refactor, reduce code duplication
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 22:58:50 +01:00
Joachim Nilsson c82dc54205 initctl: Minor refactor, handle errors first
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 02:46:19 +01:00
Joachim Nilsson 51c5f3cbfa Length of the ANSI escaped runlevels string is 20 chars, need 21
Problem reported by @wkz

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-23 19:20:25 +02:00
Joachim Nilsson a36dafaa6c README: Update initctl usage
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-19 20:16:37 +02:00
Joachim Nilsson c092d22d48 initctl: Default to show services listing, not usage text
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-19 20:01:15 +02:00
Joachim Nilsson 3e71d43bff Follow-up to 22192ac, missing semicolon
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-18 23:19:41 +02:00
Joachim Nilsson 22192acce4 initctl: Make sure to NUL terminate info string from Finit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-18 22:53:23 +02:00
Joachim Nilsson 1c9f2e9b55 initctl: Fix set/clear condition
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-16 16:49:35 +02:00
Joachim Nilsson 9b8e7a0793 Minor, update documentation on raw condition dumps
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-16 14:54:48 +02:00
Joachim Nilsson 3f150901fe initctl: Align STATUS output from cond show and dump
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-16 11:26:43 +02:00
Joachim Nilsson fd090a6785 initctl: Fix 'cond dump/set/clear' commands, only show worked
This patch fixes an invalid use of strpbrk() causing all cond
sub-commands, except initctl cond show, to fail.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-16 11:23:57 +02:00
Joachim Nilsson 83445f1ebe initctl: show, use '-' for runlevels service is not member of
This patch adds a '-' for each runlevel a service/task is not part of.
The resulting listings are easier to read and also makes it clearer to
the user what happens when changing runlevels.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-16 09:43:58 +02:00
Joachim Nilsson 94aec26e8c initctl: shoow, adjust width of runlevels column, needs 12 chars
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-16 08:42:47 +02:00
Joachim Nilsson 75d29de3cc initctl: Use entire screen width for task/service description
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-12 00:19:10 +02:00
Joachim Nilsson be6f0de0df Add util.c:screen_init() to probe screen size once per boot
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 20:58:43 +02:00
Joachim Nilsson 405cf4d997 initctl: Use actual terminal/screen width for table listings
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:55:34 +02:00
Joachim Nilsson 9bcb3e5778 initctl: top:ify table headings, i.e. use captial letters
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:39:41 +02:00
Joachim Nilsson c97e23bd58 initctl: Remove currently unused -d debug flag
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:38:22 +02:00
Joachim Nilsson 73f1b986dd initctl: Fix regression in initctl utmp
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:37:59 +02:00
Joachim Nilsson b06502b0cb initctl: Use printheader() from libite for table headings
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-04 12:37:20 +02:00
Joachim Nilsson 30822f0d68 Remove UNUSED() macro and disable the compiler warning instead
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 21:59:23 +02:00
Joachim Nilsson 60df2f2ea9 Minor, cleanup old requirement for clients to set silent
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-07-02 12:41:23 +02:00
Joachim Nilsson 018a87286c initctl: Sort commands in usage according to topic
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-30 12:12:13 +02:00
Joachim Nilsson 3428cd48b7 Fix #71: Add support for enabling/disabling services in /etc/finit.d
This patch adds support for enabling and disabling services in
/etc/finit.d/ by adding another subdirectory:

    /etc/finit.d/available

Enabled service/run/task stanzas are by convention symlinked
to the parent dir.  The initctl tool has three new convenience
commands to facilitate operating with this:

   initctl list
   initctl enable  <CONF>
   initctl disable <CONF>

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-29 22:23:38 +02:00
Joachim Nilsson 36f38d5a13 initctl: Only append space between args, not at last arg
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-06-29 22:21:33 +02:00
Joachim Nilsson 9df0454b64 initctl: Support for utmp show FILE
This patch adds support for showing a log rotated (uncompressed)
UTMP/WTMP file in initctl.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-02-10 11:44:57 +01:00
Joachim Nilsson bbbaba7b47 Minor cleanup
initctl: Replace daemon-only API from user tool
utmp-api.c: Remove not needed header

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-02-10 10:20:29 +01:00