aboutsummaryrefslogtreecommitdiff
path: root/src/genrc.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-05-20 10:53:30 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-05-20 10:53:30 +0300
commitddb46c6aa42ada061e51c635c0230e4dc8eab881 (patch)
treeb003ae6af354f553207981b4fc281e8f9e19c60e /src/genrc.h
parented8389beadb7cf1f8d95fe7addbc9ff2783f4d07 (diff)
downloadgenrc-ddb46c6aa42ada061e51c635c0230e4dc8eab881.tar.gz
genrc-ddb46c6aa42ada061e51c635c0230e4dc8eab881.tar.bz2
Sentinel mode: restart the program on certain conditions
* Makefile.am: Create the ChangeLog file from git log. * configure.ac: Request git2chg * src/com_start.c: Use sigaction instead of signal. * src/genrc.8: Document new options. * src/genrc.c: New options --restart-on-exit and --restart-on-signal. * src/genrc.h (str_to_sig, str_to_int): New prototypes. (add_restart_condition): New prototype. * src/sentinel.c (restart_on, add_restart_condition): (check_failure_rate): New functions. (wait_loop): Return if restart is requested. (sentinel): Restart the program if needed.
Diffstat (limited to 'src/genrc.h')
-rw-r--r--src/genrc.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/genrc.h b/src/genrc.h
index 9842016..c6ee57b 100644
--- a/src/genrc.h
+++ b/src/genrc.h
@@ -63,6 +63,9 @@ pid_t strtopid(char const *str);
63int pid_is_running(pid_t pid); 63int pid_is_running(pid_t pid);
64 64
65void runas(void); 65void runas(void);
66int str_to_sig(char const *);
67int str_to_int(char const *);
68
66 69
67enum { 70enum {
68 MATCH_REGEX, /* extended POSIX regexp match (default) */ 71 MATCH_REGEX, /* extended POSIX regexp match (default) */
@@ -109,7 +112,14 @@ void match_pcre_free(PROCSCANBUF buf);
109int match_pcre(PROCSCANBUF buf, char const *arg); 112int match_pcre(PROCSCANBUF buf, char const *arg);
110 113
111 114
115enum {
116 RESTART_ON_EXIT,
117 RESTART_ON_SIGNAL
118};
112 119
120void add_restart_condition(int type, char const *arg);
121
122
113struct genrc_pid_closure { 123struct genrc_pid_closure {
114 char const *name; 124 char const *name;
115 int (*pid)(struct genrc_pid_closure *, PIDLIST *); 125 int (*pid)(struct genrc_pid_closure *, PIDLIST *);

Return to:

Send suggestions and report system problems to the System administrator.