Search code examples
systemdcgroupssystemctl

Linux Systemd Cgroup character meaning '`'


Can anyone explain what does is the meaning of the last line " `-813 " of the following output, why does it starts with " `- " while the majority of the systemctl output is " |-".

systemctl status timemaster
timemaster.service - Synchronize system clock to NTP and PTP time sources
  Loaded: loaded (/usr/lib/systemd/system/timemaster.service; enabled)
  Active: active (running) since Wed 2016-10-26 20:24:37 CEST; 14h ago
Main PID: 806 (timemaster)
  CGroup: /system.slice/timemaster.service
          |-806 /usr/sbin/timemaster -f /etc/timemaster.conf
          |-812 /usr/sbin/ntpd -u ntp:ntp -g -n -c /var/run/timemaster/ntp.conf
          `-813 /usr/sbin/ptp4l -l 5 -f /var/run/timemaster/ptp4l.0.conf -S -i eth4

Here is the same command with different output, it means something otherwise it would end with "└─".

 systemctl status timemaster.service
● timemaster.service - Synchronize system clock to NTP and PTP time sources
   Loaded: loaded (/usr/lib/systemd/system/timemaster.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2016-10-28 12:48:10 WEST; 1h 58min ago
 Main PID: 676 (timemaster)
   CGroup: /system.slice/timemaster.service
           ├─676 /usr/sbin/timemaster -f /etc/timemaster.conf
           └─686 /usr/sbin/chronyd -u chrony -n -f /var/run/timemaster/chrony.conf

Many thanks


Solution

  • It doesn't mean anything, it's just used as ASCII art to show the last entry in the tree. It joins the | character above it to the - character on the last entry.

    If it started with |- it would look like there was a missing entry at the bottom.

    `- is the ASCII art equivalent of └ just like |- is the ASCII art equivalent of ├

    Example:

    |- foo
    |- bar
    `- baz
    

    That is attempting to emulate these box-drawing characters:

    ├─ foo
    ├─ bar
    └─ baz
    

    Because this would look wrong:

    ├─ foo
    ├─ bar
    ├─ baz
    

    The "different output" you show is using box-drawing characters, like my second example. The first output you show is using ASCII characters, like my first example.