[systemd-devel] [PATCH] systemctl: imply --user when invoked as "sessionctl"

Tomasz Torcz tomek at pipebreaker.pl
Wed Apr 13 03:11:52 PDT 2011


  Hi,

  Typing "sessionctl status …" is easier than "systemctl --sesion status …".


-- 
Tomasz Torcz

---
 man/systemctl.xml |    5 +++--
 src/systemctl.c   |    4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/man/systemctl.xml b/man/systemctl.xml
index e9e3371..33fb506 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -43,13 +43,14 @@
         </refmeta>
 
         <refnamediv>
-                <refname>systemctl</refname>
+                <refname>systemctl, sessionctl</refname>
                 <refpurpose>Control the systemd system and service manager</refpurpose>
         </refnamediv>
 
         <refsynopsisdiv>
                 <cmdsynopsis>
                         <command>systemctl <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="req">COMMAND</arg> <arg choice="opt" rep="repeat">NAME</arg></command>
+                        <command>sessionctl <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="req">COMMAND</arg> <arg choice="opt" rep="repeat">NAME</arg></command>
                 </cmdsynopsis>
         </refsynopsisdiv>
 
@@ -214,7 +215,7 @@
                                 <term><option>--user</option></term>
 
                                 <listitem><para>Talk to the systemd
-                                manager of the calling user.</para></listitem>
+                                manager of the calling user. Implied when invoked as <command>sessionctl</command>.</para></listitem>
                         </varlistentry>
 
                         <varlistentry>
diff --git a/src/systemctl.c b/src/systemctl.c
index 0a72874..42d99e2 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -5039,7 +5039,9 @@ static int parse_argv(int argc, char *argv[]) {
 
         if (program_invocation_short_name) {
 
-                if (strstr(program_invocation_short_name, "halt")) {
+		if (strstr(program_invocation_short_name, "sessionctl")) {
+			arg_user = true;
+		} else if (strstr(program_invocation_short_name, "halt")) {
                         arg_action = ACTION_HALT;
                         return halt_parse_argv(argc, argv);
                 } else if (strstr(program_invocation_short_name, "poweroff")) {
-- 
1.7.4.2



More information about the systemd-devel mailing list