summaryrefslogtreecommitdiff
path: root/src/run/run.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-14 21:36:47 +0100
committerLennart Poettering <lennart@poettering.net>2019-04-02 08:20:10 +0200
commitefebb613c70e7b3a2870411732754a235373b3a5 (patch)
treef64f499ed35508008e5933df35e744c8275c075b /src/run/run.c
parent787be190a87a59669854e44094b0e9063564cce1 (diff)
downloadsystemd-efebb613c70e7b3a2870411732754a235373b3a5.tar.gz
core: optionally, trigger .timer units on timezone and clock changes
Fixes: #6228
Diffstat (limited to 'src/run/run.c')
-rw-r--r--src/run/run.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/run/run.c b/src/run/run.c
index ba49e0daa2..56aa9aaee6 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -124,6 +124,8 @@ static int help(void) {
" --on-unit-active=SECONDS Run SECONDS after the last activation\n"
" --on-unit-inactive=SECONDS Run SECONDS after the last deactivation\n"
" --on-calendar=SPEC Realtime timer\n"
+ " --on-timezone-change Run when the timezone changes\n"
+ " --on-clock-change Run when the realtime clock jumps\n"
" --timer-property=NAME=VALUE Set timer unit property\n"
"\nSee the %s for details.\n"
, program_invocation_short_name
@@ -170,6 +172,8 @@ static int parse_argv(int argc, char *argv[]) {
ARG_ON_UNIT_ACTIVE,
ARG_ON_UNIT_INACTIVE,
ARG_ON_CALENDAR,
+ ARG_ON_TIMEZONE_CHANGE,
+ ARG_ON_CLOCK_CHANGE,
ARG_TIMER_PROPERTY,
ARG_PATH_PROPERTY,
ARG_SOCKET_PROPERTY,
@@ -210,6 +214,8 @@ static int parse_argv(int argc, char *argv[]) {
{ "on-unit-active", required_argument, NULL, ARG_ON_UNIT_ACTIVE },
{ "on-unit-inactive", required_argument, NULL, ARG_ON_UNIT_INACTIVE },
{ "on-calendar", required_argument, NULL, ARG_ON_CALENDAR },
+ { "on-timezone-change",no_argument, NULL, ARG_ON_TIMEZONE_CHANGE},
+ { "on-clock-change", no_argument, NULL, ARG_ON_CLOCK_CHANGE },
{ "timer-property", required_argument, NULL, ARG_TIMER_PROPERTY },
{ "path-property", required_argument, NULL, ARG_PATH_PROPERTY },
{ "socket-property", required_argument, NULL, ARG_SOCKET_PROPERTY },
@@ -382,6 +388,22 @@ static int parse_argv(int argc, char *argv[]) {
arg_with_timer = true;
break;
+ case ARG_ON_TIMEZONE_CHANGE:
+ r = add_timer_property("OnTimezoneChange", "yes");
+ if (r < 0)
+ return r;
+
+ arg_with_timer = true;
+ break;
+
+ case ARG_ON_CLOCK_CHANGE:
+ r = add_timer_property("OnClockChange", "yes");
+ if (r < 0)
+ return r;
+
+ arg_with_timer = true;
+ break;
+
case ARG_TIMER_PROPERTY:
if (strv_extend(&arg_timer_property, optarg) < 0)