summaryrefslogtreecommitdiff
path: root/src/systemctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-03-09 23:58:17 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-09 23:58:17 +0100
commit90bbc9469ec29b6094dadf27aa88743d44ab56e7 (patch)
tree91333a8f42987224f2d7e837d60c15d93a689eff /src/systemctl.c
parentb925e72633bf98438f56a140520e07ec8c959e46 (diff)
condition: take a timestamp and store last result of conditions
Diffstat (limited to 'src/systemctl.c')
-rw-r--r--src/systemctl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/systemctl.c b/src/systemctl.c
index 63e74d904a..5b205fec56 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -1831,6 +1831,9 @@ typedef struct UnitStatusInfo {
int exit_code, exit_status;
+ usec_t condition_timestamp;
+ bool condition_result;
+
/* Socket */
unsigned n_accepted;
unsigned n_connections;
@@ -1922,6 +1925,16 @@ static void print_status_info(UnitStatusInfo *i) {
else
printf("\n");
+ if (!i->condition_result && i->condition_timestamp > 0) {
+ s1 = format_timestamp_pretty(since1, sizeof(since1), i->condition_timestamp);
+ s2 = format_timestamp(since2, sizeof(since2), i->condition_timestamp);
+
+ if (s1)
+ printf("\t start condition failed at %s; %s\n", s2, s1);
+ else if (s2)
+ printf("\t start condition failed at %s\n", s2);
+ }
+
if (i->sysfs_path)
printf("\t Device: %s\n", i->sysfs_path);
if (i->where)
@@ -2117,6 +2130,8 @@ static int status_property(const char *name, DBusMessageIter *iter, UnitStatusIn
i->accept = b;
else if (streq(name, "NeedDaemonReload"))
i->need_daemon_reload = b;
+ else if (streq(name, "ConditionResult"))
+ i->condition_result = b;
break;
}
@@ -2174,6 +2189,8 @@ static int status_property(const char *name, DBusMessageIter *iter, UnitStatusIn
i->inactive_exit_timestamp = (usec_t) u;
else if (streq(name, "ActiveExitTimestamp"))
i->active_exit_timestamp = (usec_t) u;
+ else if (streq(name, "ConditionTimestamp"))
+ i->condition_timestamp = (usec_t) u;
break;
}