Add support for finit <stop|start|reload|restart> JOB

This patch further extends the capabilities of the client with the
ability to control the running state of services:

    finit <stop|start|reload|restart> JOB

Since services can now exist with multiple instances the concept of
"jobs" is introduced in this patch.  A job is a numeric identifier of
the form `NUM[:NUM]`, the latter `:NUM` is the new instance syntax
introduced earlier.  See the output of `finit status` for the JOB id.

Also, with the introduction of multiple instances we broke support for
multiple related inetd services.  This became obvious when the shiny new
`finit status` was tested ... hence, this patch also contains fixes to
the inetd support.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-06-08 08:32:49 +02:00
1 parent 720324b256
commit 24e1d284ad
7 files changed
+296 -93

No files matched your search

+13 -8
View File
@@ -69,15 +69,20 @@
# define DEFHOST "noname"
#endif
#define CMD_SIZE 256
#define LINE_SIZE 1024
#define BUF_SIZE 4096
#define CMD_SIZE 256
#define LINE_SIZE 1024
#define BUF_SIZE 4096
#define INIT_MAGIC 0x03091969
#define INIT_CMD_RUNLVL 1
#define INIT_CMD_DEBUG 2
#define INIT_CMD_RELOAD 3
#define INIT_CMD_ACK 255
#define INIT_MAGIC 0x03091969
#define INIT_CMD_RUNLVL 1
#define INIT_CMD_DEBUG 2 /* Toggle Finit debug */
#define INIT_CMD_RELOAD 3 /* Reload *.conf in /etc/finit.d/ */
#define INIT_CMD_START_SVC 4
#define INIT_CMD_STOP_SVC 5
#define INIT_CMD_RELOAD_SVC 6 /* SIGHUP service */
#define INIT_CMD_RESTART_SVC 7 /* STOP + START service */
#define INIT_CMD_NACK 254
#define INIT_CMD_ACK 255
struct init_request {
int magic; /* Magic number */