Ocultando a parte “log” da saída 'systemctl status'

2

Para uma demonstração, eu gostaria de usar systemctl status para mostrar o status de um serviço de forma amigável, mas ocultando a parte do registro:

### I Want that ####################################

root@bulbizarre:/home/sylvain# systemctl status ssh.service
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
   Active: active (running) since Tue 2018-10-09 10:51:59 CEST; 3 days ago
  Process: 1735 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCES
  Process: 1729 ExecReload=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
  Process: 1194 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 1240 (sshd)
    Tasks: 1 (limit: 4915)
   Memory: 1.9M
      CPU: 80ms
   CGroup: /system.slice/ssh.service
           └─1240 /usr/sbin/sshd -D

### But not that ####################################

Oct 09 10:52:26 bulbizarre systemd[1]: Reloaded OpenBSD Secure Shell server.
Oct 09 10:52:26 bulbizarre sshd[1240]: Server listening on 0.0.0.0 port 22.
Oct 09 10:52:26 bulbizarre sshd[1240]: Server listening on :: port 22.
Oct 09 13:57:52 bulbizarre sshd[6966]: pam_unix(sshd:auth): authentication failu
Oct 09 13:57:52 bulbizarre sshd[6966]: pam_ldap(sshd:auth): Authentication failu
Oct 09 13:57:54 bulbizarre sshd[6966]: Failed password for sylvain from 10.129.3
Oct 09 13:57:57 bulbizarre sshd[6966]: pam_ldap(sshd:auth): Authentication failu
Oct 09 13:58:00 bulbizarre sshd[6966]: Failed password for sylvain from 10.129.3
Oct 09 13:58:02 bulbizarre sshd[6966]: Accepted password for sylvain from 10.129
Oct 09 13:58:02 bulbizarre sshd[6966]: pam_unix(sshd:session): session opened fo

Existe alguma opção oculta para isso? Eu sei sobre a opção -o , mas AFAIK não há formato "vazio".

    
por Sylvain Leroux 12.10.2018 / 14:57

1 resposta

2

Quão estúpida eu sou! Logo depois de ter feito a pergunta eu tenho uma iluminação e eu tentei isso:

systemctl --lines 0 status ssh.service
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-10-09 10:51:59 CEST; 3 days ago
  Process: 1735 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 1729 ExecReload=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
  Process: 1194 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 1240 (sshd)
    Tasks: 1 (limit: 4915)
   Memory: 1.9M
      CPU: 80ms
   CGroup: /system.slice/ssh.service
           └─1240 /usr/sbin/sshd -D
   -n, --lines=
       When used with status, controls the number of journal lines to show, counting from the
       most recent ones. Takes a positive integer argument. Defaults to 10.

Não é óbvio, a partir do man , se isto deveria funcionar dessa forma (n deve ser positivo , não seguro se incluir zero ), de qualquer forma --lines=0 remove o log completamente (incluindo a linha separadora vazia).

    
por 12.10.2018 / 14:59

Tags