From: Andre Noll Date: Sat, 26 Mar 2011 14:37:06 +0000 (+0100) Subject: Implement --reload. X-Git-Tag: v0.1.5~13^2~1 X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=commitdiff_plain;h=55c90e8e1d56bc2aec456067cdd1789d09f97d74 Implement --reload. This is literally the same as --kill, the only difference being that SIGHUP rather than SIGTERM is sent. --- diff --git a/dss.c b/dss.c index 63f5f56..793e919 100644 --- a/dss.c +++ b/dss.c @@ -172,7 +172,9 @@ static void dump_dss_config(const char *msg) COMMAND(create) \ COMMAND(prune) \ COMMAND(run) \ - COMMAND(kill) + COMMAND(kill) \ + COMMAND(reload) \ + #define COMMAND(x) static int com_ ##x(void); COMMANDS #undef COMMAND @@ -240,7 +242,7 @@ static char *get_config_file_name(void) return config_file; } -static int com_kill(void) +static int send_signal(int sig) { pid_t pid; char *config_file = get_config_file_name(); @@ -253,12 +255,22 @@ static int com_kill(void) dss_msg("%d\n", (int)pid); return 0; } - ret = kill(pid, SIGTERM); + ret = kill(pid, sig); if (ret < 0) return -ERRNO_TO_DSS_ERROR(errno); return 1; } +static int com_kill(void) +{ + return send_signal(SIGTERM); +} + +static int com_reload(void) +{ + return send_signal(SIGHUP); +} + static void dss_get_snapshot_list(struct snapshot_list *sl) { get_snapshot_list(sl, conf.unit_interval_arg, conf.num_intervals_arg); diff --git a/dss.ggo b/dss.ggo index c594f6e..38e8637 100644 --- a/dss.ggo +++ b/dss.ggo @@ -155,6 +155,15 @@ details=" process is written to stdout, but no signal is sent. " +groupoption "reload" - +#~~~~~~~~~~~~~~~~~~~~~ +"force a running dss process to reload its config file" +group="command" +details=" + This differs from --kill only in that SIGHUP rather than SIGTERM + is sent to the dss process. +" + ############################### section "Rsync-related options" ###############################