summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Werkmeister <mail@lucaswerkmeister.de>2016-10-27 15:28:10 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-27 09:28:10 -0400
commite100155dccaf90521f3e4da5af06736685e9e935 (patch)
tree3558a38e56338528787b8eea36ced0b53df63fde
parented06fa62035b96a5e93463e7b1a7b0203bee6fbb (diff)
systemctl: warn when cat shows changed unit files (#4493)
Suggested by @keszybz in #4488.
-rw-r--r--src/systemctl/systemctl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 35d5c11cc7..d311bbec1a 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5272,6 +5272,20 @@ static int cat(int argc, char *argv[], void *userdata) {
else
puts("");
+ if (need_daemon_reload(bus, *name))
+ fprintf(stderr,
+ "%s# Warning: %s changed on disk, the version systemd has loaded is outdated.\n"
+ "%s# This output shows the current version of the unit's original fragment and drop-in files.\n"
+ "%s# If fragments or drop-ins were added or removed, they are not properly reflected in this output.\n"
+ "%s# Run 'systemctl%s daemon-reload' to reload units.%s\n",
+ ansi_highlight_red(),
+ *name,
+ ansi_highlight_red(),
+ ansi_highlight_red(),
+ ansi_highlight_red(),
+ arg_scope == UNIT_FILE_SYSTEM ? "" : " --user",
+ ansi_normal());
+
if (fragment_path) {
r = cat_file(fragment_path, false);
if (r < 0)