summaryrefslogtreecommitdiff
path: root/src/systemctl
AgeCommit message (Collapse)Author
2016-04-12core: make sure we generate a nicer error when a linked unit is attempted to ↵Lennart Poettering
be enabled We don't allow using config symlinks to enable units, but the error message we printed was awful. Fix that, and generate a more readable error. Fixes #3010.
2016-04-12core,systemctl: add new "systemctl revert" commandLennart Poettering
This allows dropping all user configuration and reverting back to the vendor default of a unit file. It basically undoes what "systemctl edit", "systemctl set-property" and "systemctl mask" do.
2016-04-12systemctl: don't confuse sysv code with generated unitsLennart Poettering
The SysV compat code checks whether there's a native unit file before looking for a SysV init script. Since the newest rework generated units will show up in the unit path, and hence the checks ended up assuming that there always was a native unit file for each init script: the generated one. With this change the generated unit file directory is suppressed from the search path when this check is done, to avoid the confusion.
2016-04-12systemctl: add error message when we get unexpected event from waitid()Lennart Poettering
We should log about everything we don't expect. Also, add a comment for one case were we do not log, on purpose, and make it use a separate error code.
2016-04-12systemctl: fix incorrect errno for error messageLennart Poettering
2016-04-12systemctl: move check whether a service exists as native unit file to install.cLennart Poettering
Move the search path check from the SysV service compat support into install.c so that we can reuse the usual algorithm instead of rolling a private loop for this.
2016-04-12core: rework reboot parameter logic a bitLennart Poettering
Always warn if something fails, and clarify that the involved utility functions do so in their name. Drop the REBOOT_PARAM_FILE macro. We don't do this for other flag file paths like this, so don't do this for this one either. The path isn't configurable anyway, hence let's make this easier to read by avoiding this one indirection.
2016-04-12install: introduce a new unit file state "transient"Lennart Poettering
Now, that the search path logic knows the unit path for transient units we also can introduce an explicit unit file state "transient" that clarifies to the user what kind of unit file he is encountering.
2016-04-12core: remove ManagerRunningAs enumLennart Poettering
Previously, we had two enums ManagerRunningAs and UnitFileScope, that were mostly identical and converted from one to the other all the time. The latter had one more value UNIT_FILE_GLOBAL however. Let's simplify things, and remove ManagerRunningAs and replace it by UnitFileScope everywhere, thus making the translation unnecessary. Introduce two new macros MANAGER_IS_SYSTEM() and MANAGER_IS_USER() to simplify checking if we are running in one or the user context.
2016-04-12systemctl: port systemctl over to the new LookupPaths configuration ↵Lennart Poettering
directory fields
2016-04-12core: when enabling a generated unit file, return a clean errorLennart Poettering
Let's be precise when the user tries to invoke an "enable" operation on a generated unit file.
2016-04-12core: add a new unit file state "generated"Lennart Poettering
Now that we store the generator directories in LookupPaths we can use this to intrdouce a new unit file state called "generated", for units in these directories. Fixes: #2348
2016-04-12core: rework generator dir logic, move the dirs into LookupPaths structureLennart Poettering
A long time ago – when generators where first introduced – the directories for them were randomly created via mkdtemp(). This was changed later so that they use fixed name directories now. Let's make use of this, and add the genrator dirs to the LookupPaths structure and into the unit file search path maintained in it. This has the benefit that the generator dirs are now normal part of the search path for all tools, and thus are shown in "systemctl list-unit-files" too.
2016-04-06Merge pull request #2962 from keszybz/value-optionLennart Poettering
Add `--value` option to systemctl and loginctl to only print values
2016-04-04systemctl: add --value optionZbigniew Jędrzejewski-Szmek
With this option, systemctl will only print the rhs in show: $ systemctl show -p Wants,After systemd-journald --value systemd-journald.socket ... systemd-journald-dev-log.socket ... This is useful in scripts, because the need to call awk or similar is removed.
2016-04-01systemctl: use correct printf macros for uint32Martin Pitt
%u is a simple uint which might not be 32 bit on every platform. Use PRIu32 instead.
2016-03-23systemctl: no need to pass --all if inactive is explicitly requested in ↵Franck Bui
list-units If list-units command is explicitly asked to show inactive units by using '--state=inactive' option, there's no need to force the user to pass '--all' option to include inactive units in the search in this case.
2016-03-07Merge pull request #2768 from benjarobin/fix-2718Daniel Mack
systemctl: Replace check_one_unit() by get_state_one_unit()
2016-03-05systemctl: improve error message when starting a unit failedRonny Chevalier
Fixes #2798
2016-03-03systemctl: add missing OOM checkRonny Chevalier
2016-03-02systemctl: rm empty dropin dirs after cancelled editRonny Chevalier
Fixes #2734
2016-02-29systemctl: Fix warn: action_to_runlevel() is not usedBenjamin ROBIN
If HAVE_SYSV_COMPAT is not defined: ‘action_to_runlevel’ defined but not used
2016-02-29systemctl: Replace check_one_unit() by get_state_one_unit()Benjamin ROBIN
The get_state_one_unit returns the enum of the active state of the unit Do not rely on the string value of the active state. Fix #2718 since the refactoring allow to handle more case
2016-02-25Merge pull request #2671 from 0xAX/move-pager-open-to-one-placeZbigniew Jędrzejewski-Szmek
tree-wide: merge pager_open_if_enabled() to the pager_open()
2016-02-26tree-wide: merge pager_open_if_enabled() to the pager_open()Alexander Kuleshov
Many subsystems define own pager_open_if_enabled() function which checks '--no-pager' command line argument and open pager depends on its value. All implementations of pager_open_if_enabled() are the same. Let's merger this function with pager_open() from the shared/pager.c and remove pager_open_if_enabled() from all subsytems to prevent code duplication.
2016-02-23tree-wide: minor formatting inconsistency cleanupsVito Caputo
2016-02-22tree-wide: make ++/-- usage consistent WRT spacingVito Caputo
Throughout the tree there's spurious use of spaces separating ++ and -- operators from their respective operands. Make ++ and -- operator consistent with the majority of existing uses; discard the spaces.
2016-02-15systemctl: fix style to avoid modification of array passed by callerZbigniew Jędrzejewski-Szmek
Followup for 4524439edb7d.
2016-02-15systemctl: include -M or -H arguments in the hintZbigniew Jędrzejewski-Szmek
https://github.com/systemd/systemd/issues/2431 Some newlines are added, but the output will still exceed 80 columns in many cases. The fallback for oom conditions is changed from "n/a" to something "<service>", and a similar pattern is used for the new code. This way we have a realistic fallback for oom, which seems nicer than making the whole function return an error code which would then have to be propagated. $ systemctl -M fedora-rawhide restart systemd-networkd.service Job for systemd-networkd.service failed because start of the service was attempted too often. See "systemctl -M fedora-rawhide status systemd-networkd.service" and "journalctl -M fedora-rawhide -xe" for details. To force a start use "systemctl -M fedora-rawhide reset-failed systemd-networkd.service" followed by "systemctl -M fedora-rawhide start systemd-networkd.service" again.
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2016-02-01core: fix support for transient resource limit propertiesLennart Poettering
Make sure we can properly process resource limit properties. Specifically, allow transient configuration of both the soft and hard limit, the same way from the unit files. Previously, only the the hard rlimits could be configured but they'd implicitly spill into the soft hard rlimits. This also updates the client-side code to be able to parse hard/soft resource limit specifications. Since we need to serialize two properties in bus_append_unit_property_assignment() now, the marshalling of the container around it is now moved into the function itself. This has the benefit of shortening the calling code. As a side effect this now beefs up the rlimit parser of "systemctl set-property" to understand time and disk sizes where that's appropriate.
2016-01-29systemctl: actually honour the try-reload-or-restart verb aabf5d4243408 promisedLennart Poettering
The verb entry got lost in the ultimate commit.
2016-01-29systemctl: make most systemctl commands NOPs in a chroot() environmentLennart Poettering
Fixes #2015
2016-01-29systemctl: consider a chroot() environment always offlineLennart Poettering
2016-01-28systemctl: rename "reload-or-try-restart" verb to "try-reload-or-restart"Lennart Poettering
But also keep the old name as (undocumented) compatibility around. The reload-or-try-restart was documented to be a NOP if the unit is not running, since the previous commits this is also implemented. The old name suggests that the "try" logic only applies to restarting. Fix this, by moving the "try-" to the front, to indicate that the whole option is a NOP if the service isn't running.
2016-01-28systemctl: don't make up unit states, and don't eat up errors to eagerlyLennart Poettering
When checking a unit's state, don't ignore errors too eagerly, but generate proper error messages. Also, don't synthesize an "unknown" state on error, but let the operation file. If a unit file isn't loaded treat this as "inactive" as that's effectively what it means.
2016-01-28systemctl: don't mangle unit names in check_unit_generic()Lennart Poettering
As it turns out all callers of check_unit_generic() already mangle unit names, or get the unit names directly from PID 1 (and hence arein normalized form anyway), hence there's no point in mangling then...
2016-01-27systemctl: piece-meal strv extension is expensiveLennart Poettering
If we have many entries to add to an strv we really should try to be smarter than constantly realloc()ing the strv array. Instead, grow it exponentially.
2016-01-25systemctl: is-active/failed should return 0 if at least one unit is in given ↵Lukas Nykryn
state Previously we have return the not-found code, in the case that we found a unit which does not belong to set active (resp. failed), which is the opposite than what is written in man page.
2016-01-21systemctl: Allow 'edit' and 'cat' on unloaded unitsDouglas Christman
Don't fail if the unit has a LoadError; otherwise `systemctl edit` cannot be used to correct the error (e.g. multiple "ExecStart=" lines). Remove file changed warning so cat output isn't interspersed with log messages. Fixes #829
2016-01-20Merge pull request #2085 from fbuihuu/more-use-of-check-load-stateLennart Poettering
core: use bus_unit_check_load_state() in transaction_add_job_and_depe…
2016-01-20basic/terminal-util: introduce SYSTEMD_COLORS environment variableJan Synacek
... to determine if color output should be enabled. If the variable is not set, fall back to using on_tty(). Also, rewrite existing code to use colors_enabled() where appropriate.
2016-01-14Merge pull request #2316 from poettering/dnssec14Tom Gundersen
Fourteenth DNSSEC PR
2016-01-14bus-util: print "systemctl --user" on user service managerWaLyong Cho
When a unit was started with "systemctl --user" and it failed, error messages is printed as "systemctl status". But it should be "systemctl --user status".
2016-01-13systemctl: improve wording of "systemctl enable" messagesLennart Poettering
Closes: #2299
2015-12-02core: use bus_unit_check_load_state() in transaction_add_job_and_dependencies()Franck Bui
2015-11-27tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering
GLIB has recently started to officially support the gcc cleanup attribute in its public API, hence let's do the same for our APIs. With this patch we'll define an xyz_unrefp() call for each public xyz_unref() call, to make it easy to use inside a __attribute__((cleanup())) expression. Then, all code is ported over to make use of this. The new calls are also documented in the man pages, with examples how to use them (well, I only added docs where the _unref() call itself already had docs, and the examples, only cover sd_bus_unrefp() and sd_event_unrefp()). This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we tend to call our destructors these days. Note that this defines no public macro that wraps gcc's attribute and makes it easier to use. While I think it's our duty in the library to make our stuff easy to use, I figure it's not our duty to make gcc's own features easy to use on its own. Most likely, client code which wants to make use of this should define its own: #define _cleanup_(function) __attribute__((cleanup(function))) Or similar, to make the gcc feature easier to use. Making this logic public has the benefit that we can remove three header files whose only purpose was to define these functions internally. See #2008.
2015-11-22systemctl: do not return uninitialized rThomas Hindoe Paaboel Andersen
Regresssed during port to extract_first_word in 5ab22f3321d238957c03dcc6a6db76491e3989b8 CID #1338060
2015-11-18systemctl: open pager for 'status', since process tree can get very longLennart Poettering
2015-11-18systemctl: make sure 'status' shows whether units are transientLennart Poettering