Commit Graph

300 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek b3ae710c25 systemctl: update NAME to PATTERN in help()
Previously the man page was modified, but not help().
2014-04-05 00:42:10 -04:00
Brandon Philips 93c941e3fb systemctl: fix spelling in comment 2014-03-27 11:56:33 -07:00
Lennart Poettering dedabea4b3 timer: support timers that can resume the system from suspend 2014-03-24 16:24:07 +01:00
Lennart Poettering d784e2dbac systemctl: show last trigger time in "systemctl list-timers" 2014-03-24 03:42:17 +01:00
Lennart Poettering 50933da01b systemctl: sort local host entry before container in list-machines output 2014-03-18 04:46:55 +01:00
Lennart Poettering 90c3f79dc7 systemctl: prefix list-units and list-machines output with a circle indicating a failure state
(Subject to --no-legend)
2014-03-18 04:46:55 +01:00
Lennart Poettering 1238ee09b7 systemctl: introduce -r switch to show units running in local containers in addition to the host 2014-03-17 04:00:44 +01:00
Josh Triplett f8294e4175 Use strlen even for constant strings
GCC optimizes strlen("string constant") to a constant, even with -O0.
Thus, replace patterns like sizeof("string constant")-1 with
strlen("string constant") where possible, for clarity.  In particular,
for expressions intended to add up the lengths of components going into
a string, this often makes it clearer that the expression counts the
trailing '\0' exactly once, by putting the +1 for the '\0' at the end of
the expression, rather than hidden in a sizeof in the middle of the
expression.
2014-03-16 09:52:56 -04:00
Sebastian Thorarensen 9003d9b0d6 utmp-wtmp: allow overriding username on wall
utmp_wall() now takes an optional argument 'username_override' which
allows the caller to override the username shown on wall messages.
journald will use this to inform users that its wall messages comes from
'systemd-journald'.
2014-03-14 21:27:33 +01:00
Lennart Poettering c3441de061 systemctl: autopage always if systemctl status is invoked without args 2014-03-13 04:17:37 +01:00
Lennart Poettering ea6c2dd1f8 systemctl: suppress duplicate newline if there's not log output in "systemctl status" 2014-03-13 04:17:37 +01:00
Lennart Poettering 15ef11449b systemctl: reorder verbs 2014-03-13 04:17:37 +01:00
Lennart Poettering 3df538da67 systemctl: make sure status -a doesn't terminate too soon 2014-03-13 04:17:37 +01:00
Lennart Poettering b0d14c69b2 systemctl: show a colored red dot in "status" output indicating the state of a unit 2014-03-13 04:17:37 +01:00
Lennart Poettering 8fcf784dff systemctl: when "systemctl status" is called without arguments show a short overall system state
Previously "systemctl status" without argument would print the status of
all loaded units. This has now been moved to "systemctl status -a".
2014-03-12 23:33:46 +01:00
Lennart Poettering 0d292f5e75 systemctl: add new "list-machines" command
"systemctl list-machines" shows one line per local container which
includes the current system state of the container, the number of failed
units as well as the number of currently queued jobs.
2014-03-12 21:16:45 +01:00
Harald Hoyer f39d4a08e7 systemctl: for switch-root check, if we switch to a systemd init
If "systemctl switch-root" is called with a specific "INIT" or
/proc/cmdline contains "init=", then systemd would not serialize
itsself.

Let systemctl check, if the new init is in the standard systemd
installation path and if so, clear the INIT parameter,
to let systemd serialize itsself.
2014-03-11 04:45:33 +01:00
Lennart Poettering df31a6c0fe systemd-run: add new --property= switch that can set arbitrary properties for the unit that is created
The code for parsing these properties is shared with "systemctl
set-property", which means all the resource control settings are
immediately available.
2014-03-05 03:36:22 +01:00
Zbigniew Jędrzejewski-Szmek 6e18964d3a Introduce strv_consume which takes ownership
This mirrors set_consume and makes the common use a bit nicer.
2014-03-04 10:04:50 -05:00
Zbigniew Jędrzejewski-Szmek 41a55c46ab Replace /var/run with /run in remaining places
/run was already used almost everywhere, fix the remaining places
for consistency.
2014-02-25 20:41:24 -05:00
Djalal Harouni f5080e7385 systemctl: move next elapse calculation to its own function 2014-02-23 23:53:25 -05:00
Lennart Poettering 5556b5fe41 core: clean up some confusing regarding SI decimal and IEC binary suffixes for sizes
According to Wikipedia it is customary to specify hardware metrics and
transfer speeds to the basis 1000 (SI decimal), while software metrics
and physical volatile memory (RAM) sizes to the basis 1024 (IEC binary).
So far we specified everything in IEC, let's fix that and be more
true to what's otherwise customary. Since we don't want to parse "Mi"
instead of "M" we document each time what the context used is.
2014-02-23 03:19:04 +01:00
Daniel Mack 9e82ffa040 systemctl: fix compiler warning in list_timers()
get_next_elapse() will always fill 'next' with values when it
returns >= 0. Hence, the compiler is wrong about this warning.
Initialize 'next' nevertheless.

src/systemctl/systemctl.c: In function ‘list_timers’:
src/systemctl/systemctl.c:953:43: warning: ‘next.monotonic’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
                                 converted = nw.realtime - (nw.monotonic - next.monotonic);
                                           ^
In file included from ./src/shared/log.h:30:0,
                 from src/systemctl/systemctl.c:46:
./src/shared/macro.h:137:38: warning: ‘next.realtime’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
                         _a < _b ? _a : _b;      \
                                      ^
src/systemctl/systemctl.c:933:32: note: ‘next.realtime’ was declared here
                 dual_timestamp next;
                                ^
2014-02-21 12:05:38 +01:00
Lennart Poettering 151b9b9662 api: in constructor function calls, always put the returned object pointer first (or second)
Previously the returned object of constructor functions where sometimes
returned as last, sometimes as first and sometimes as second parameter.
Let's clean this up a bit. Here are the new rules:

1. The object the new object is derived from is put first, if there is any

2. The object we are creating will be returned in the next arguments

3. This is followed by any additional arguments

Rationale:

For functions that operate on an object we always put that object first.
Constructors should probably not be too different in this regard. Also,
if the additional parameters might want to use varargs which suggests to
put them last.

Note that this new scheme only applies to constructor functions, not to
all other functions. We do give a lot of freedom for those.

Note that this commit only changes the order of the new functions we
added, for old ones we accept the wrong order and leave it like that.
2014-02-20 00:03:10 +01:00
Maciej Wereski 31d5a60cae systemctl: remove erroneous return in runlevel_parse_argv() 2014-02-19 16:24:16 +01:00
Dave Reisner 5a1aece581 systemctl: fix exit statuses from is-active/is-failed
This was inadvertantly disturbed in e3e0314b when glob support was
added.
2014-02-13 10:14:31 -05:00
Lennart Poettering 57183d117a core: add SystemCallArchitectures= unit setting to allow disabling of non-native
architecture support for system calls

Also, turn system call filter bus properties into complex types instead
of concatenated strings.
2014-02-13 00:24:00 +01:00
Tom Gundersen 36e0e6311b includes: remove duplicate includes
Found by the new check-includes make target.
2014-02-10 13:06:31 +01:00
Lennart Poettering 67d6621059 systemctl: skip native unit file handling if sysv file handling already handled everything
Issue pointed out by Colin Guthrie.
2014-01-20 13:43:57 +01:00
Lennart Poettering ac3efa8ac6 systemctl: introduce new "import-environment" command
This may be used in graphical session start-up scripts to upload
environment variables such as $DISPLAY into the systemd manager easily.
2014-01-15 20:16:20 +01:00
Simon Peeters e3e45d4f82 strv: multiple cleanups
- turn strv_merge into strv_extend_strv.
   appending strv b to the end of strv a instead of creating a new strv
- strv_append: remove in favor of strv_extend and strv_push.
- strv_remove: write slightly more elegant
- strv_remove_prefix: remove unused function
- strv_overlap: use strv_contains
- strv_printf: STRV_FOREACH handles NULL correctly
2014-01-05 09:16:15 -05:00
Thomas Hindoe Paaboel Andersen 39602c3905 systemctl: improve readability on failed commands
Not long ago a failed command would print:
"Failed to start something.service: ..."
regardless of whether the command was to start/stop/restart/etc.

With e3e0314 this was improved to print the method used. E.g. for stopping:
"Failed to StopUnit something.service: ..."

This patch matches the method to a more human readable word. E.g:
"Failed to stop something.service: ..."
2014-01-04 12:49:40 +01:00
Thomas Hindoe Paaboel Andersen 984af580b3 systemctl: remove unused variable 2013-12-27 12:04:00 +01:00
Zbigniew Jędrzejewski-Szmek f78e6385dc Use enums to make it obvious what boolean params mean
Suggested-by: Russ Allbery <rra@debian.org>
2013-12-26 15:49:54 -05:00
Zbigniew Jędrzejewski-Szmek e3e0314b56 systemctl: allow globbing in commands which take multiple unit names 2013-12-26 13:24:36 -05:00
Zbigniew Jędrzejewski-Szmek 8d5ba5a946 systemctl: drop uninteresting units immediately
Also properly free memory if list-unit-files --root=... is used.
2013-12-26 11:24:42 -05:00
Zbigniew Jędrzejewski-Szmek b652054662 systemctl: simplify start_unit 2013-12-26 11:24:42 -05:00
Zbigniew Jędrzejewski-Szmek 58684be9a7 systemctl: also color filenames of drop-ins in cat 2013-12-22 18:55:01 -05:00
Lennart Poettering 373d32c9f4 systemctl: fix bad memory access when processing PIDs on the "systemctl status" command line 2013-12-21 05:15:09 +01:00
Zbigniew Jędrzejewski-Szmek a669d6226d systemct: add empty line between units in cat 2013-12-18 23:58:24 -05:00
Zbigniew Jędrzejewski-Szmek c0fdf09885 systemctl: highlight filenames in cat 2013-12-16 23:21:51 -05:00
Zbigniew Jędrzejewski-Szmek c0ea486f6e systemctl: fix return value from cat 2013-12-16 23:21:51 -05:00
Lennart Poettering 999b600390 systemctl: properly initialize and free sd_bus_error in "systemctl cat"
We need to properly initialize all error structs before use and free
them after use.

Also, there's no point in flushing stdout if we output a \n anyway...
2013-12-16 21:06:57 +01:00
Djalal Harouni 815ebc540d systemctl: add the --plain option to the help message 2013-12-14 18:13:24 -05:00
Zbigniew Jędrzejewski-Szmek 04504f93d1 systemctl: fix 'is-enabled' 2013-12-08 19:26:51 -05:00
Zbigniew Jędrzejewski-Szmek d08e75edf9 systemctl: simplify argument parsing 2013-12-08 19:26:51 -05:00
Zbigniew Jędrzejewski-Szmek 4f8f66cb42 Help output spring cleaning
Use [brackets] only for optional elements.
Use <optional> in XML sources.
2013-12-08 19:26:51 -05:00
Thomas Hindoe Paaboel Andersen 4c49ab0e7a systemctl: fix and refactor wait_for_jobs
wait_for_jobs was ignoring the errors from the jobs stored in r.
It would only ever return whether the call to sd_bus_remove_filter
went ok. This patch changes it to return the first job related error
encountered. If a job related error is found, then the result of the
call to sd_bus_remove_filter is ignored.

wait_for_jobs was a bit hard to read so I split it up to avoid
the goto and deep nesting.
2013-12-07 22:39:46 +01:00
Zbigniew Jędrzejewski-Szmek d8fba7c6cc systemctl: allow globbing in list-<whatever> commands
It is nicer to say 'systemctl list-units ssh\*' then to use grep,
because colouring is preserved and it is easier to match just against
the unit name.
2013-12-06 21:29:55 -05:00
Zbigniew Jędrzejewski-Szmek 2b6bf07dd2 Get rid of our reimplementation of basename
The only problem is that libgen.h #defines basename to point to it's
own broken implementation instead of the GNU one. This can be fixed
by #undefining basename.
2013-12-06 21:29:55 -05:00