[systemd-devel] how to know what exactly parameter set in busCtl methods?
Mantas Mikulėnas
grawity at gmail.com
Tue Jan 16 13:22:04 UTC 2018
On Tue, Jan 16, 2018 at 1:52 PM, Tomasz Michalski <tmichalski23 at gmail.com>
wrote:
> Hi
> I have a problem with call methods from terminal which take an argument,
> for example when I try to use this one:
> busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/syscom_2epath
> org.freedesktop.systemd1.Unit Kill
> I get output
> Invalid arguments '' to call org.freedesktop.systemd1.Unit.Kill(),
> expecting 'si'.
>
> The same with Restart:
> Invalid arguments '' to call org.freedesktop.systemd1.Unit.Restart(),
> expecting 's'.
>
> I know that some parameters has to be given acc to introspects:
> busctl introspect org.freedesktop.systemd1 /org/freedesktop/systemd1/
> unit/syscom_2epath
> .Result property s "success"
>
> .Unit property s "syscom.service"
>
> org.freedesktop.systemd1.Unit interface - -
>
> .Kill method si -
>
> .Reload method s o
>
> .ReloadOrRestart method s o
>
> .ReloadOrTryRestart method s o
>
> .ResetFailed method - -
>
> .Restart method s o
>
> .SetProperties method ba(sv) -
>
> .Start method s o
>
> .Stop method s o
>
> .TryRestart method s o
>
> However I don't know what I should exactly write, what exactly string? I
> tried for example:
> busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/syscom_2eservice
> org.freedesktop.systemd1.Unit Restart "dupa"
> I got output:
> Too few parameters for signature.
>
> How can I get to know what exactly should I give as parameter. This is a
> bit frustrating.
>
See the API documentation at:
https://www.freedesktop.org/wiki/Software/systemd/dbus/
The Unit.Restart() call is documented as:
Restart(in s mode, out o job);
this means it takes one string parameter – the job mode.
Job mode is the same as Manager.StartUnit(), and is documented as:
The mode needs to be one of replace, fail, isolate, ignore-dependencies,
ignore-requirements. If "replace" the call will start the unit and its
dependencies, possibly replacing already queued jobs that conflict with
this. If "fail" the call will start the unit and its dependencies, but will
fail if this would change an already queued job. If "isolate" the call will
start the unit in question and terminate all units that aren't dependencies
of it. If "ignore-dependencies" it will start a unit but ignore all its
dependencies. If "ignore-requirements" it will start a unit but only ignore
the requirement dependencies. It is not recommended to make use of the
latter two options. Returns the newly created job object.
So "replace" would be an acceptable value. "dupa" is not.
Depending on the tools used, you need to declare the type of each
parameter. For example, busctl requires the "signature" (all input
parameter types together – in this case, just an "s") to be specified after
the method call; for example:
busctl call ... org.freedesktop.systemd1.Unit Restart s replace
gdbus or dbus-send each have their own, different syntax.
--
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180116/e5f548f5/attachment.html>
More information about the systemd-devel
mailing list