mirror of
https://github.com/troglobit/finit.git
synced 2026-11-17 19:30:29 +00:00
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:
1 parent
720324b256
commit
24e1d284ad
7 files changed
+296
-93
No files matched your search
@@ -61,7 +61,7 @@ typedef enum {
|
||||
* initctl <stop|start|restart> service */
|
||||
typedef struct svc {
|
||||
/* Instance specifics */
|
||||
int id;
|
||||
int job, id; /* JOB:ID */
|
||||
|
||||
/* Service details */
|
||||
pid_t pid;
|
||||
@@ -114,11 +114,12 @@ static inline svc_t *finit_svc_connect(void)
|
||||
return (svc_t *)ptr;
|
||||
}
|
||||
|
||||
svc_t *svc_new (int id);
|
||||
svc_t *svc_new (char *cmd, int id, int type);
|
||||
int svc_del (svc_t *svc);
|
||||
|
||||
svc_t *svc_find (char *path, int id);
|
||||
svc_t *svc_find (char *cmd, int id);
|
||||
svc_t *svc_find_by_pid (pid_t pid);
|
||||
svc_t *svc_find_by_jobid (int job, int id);
|
||||
|
||||
svc_t *svc_iterator (int first);
|
||||
svc_t *svc_inetd_iterator (int first);
|
||||
@@ -130,6 +131,10 @@ void svc_foreach_dynamic (void (*cb)(svc_t *));
|
||||
void svc_mark_dynamic (void);
|
||||
void svc_clean_dynamic (void (*cb)(svc_t *));
|
||||
|
||||
char *svc_status (svc_t *svc);
|
||||
int svc_next_id (char *cmd);
|
||||
int svc_is_unique (svc_t *svc);
|
||||
|
||||
static inline int svc_is_inetd (svc_t *svc) { return svc && SVC_TYPE_INETD == svc->type; }
|
||||
static inline int svc_is_daemon(svc_t *svc) { return svc && SVC_TYPE_SERVICE == svc->type; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user