From 9d41d49fb12d3401749d165ed541fbd96dd6521e Mon Sep 17 00:00:00 2001 From: Alban Vidal Date: Thu, 20 Sep 2018 07:24:11 +0200 Subject: [PATCH] Add systemd and journald aliases Signed-off-by: Alban Vidal --- root/.bashrc | 14 ----- root/.profile.d/00_systemd_journal.conf | 73 +++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 root/.profile.d/00_systemd_journal.conf diff --git a/root/.bashrc b/root/.bashrc index c5fcf4b..1cb4a8a 100644 --- a/root/.bashrc +++ b/root/.bashrc @@ -21,20 +21,6 @@ alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' -# Alias / fonctions for journald -alias jf="journalctl -f" -function jfu(){ - for UNIT in $@; do - UNITS+=" -u $UNIT" - done - journalctl -f $UNITS; -} - -# Alias / fonctions for systemd -alias scf="systemctl list-units --failed" -function scs(){ systemctl status $@; } -function scc(){ systemctl cat $@; } - # Git : alias ggb="cd /srv/git/basic_config_debian" alias gs="git status" diff --git a/root/.profile.d/00_systemd_journal.conf b/root/.profile.d/00_systemd_journal.conf new file mode 100644 index 0000000..a59ec42 --- /dev/null +++ b/root/.profile.d/00_systemd_journal.conf @@ -0,0 +1,73 @@ +################################################################################ +# Systemd and journald aliases + +# TODO : add color in help-journald + +echo -e "\nEnter 'help-journald' to print internal aliases and functions for systemd/journald" + +alias help-journald='echo " +Log level: +0 - emerg +1 - alert +2 - crit +3 - err +4 - warning +5 - notice +6 - info +7 - debug + +Journald from boot - default level : jb +Journald from boot - level crit : jbc +Journald from boot - level err : jbe +Journald from boot - level warning : jbw + +Journald follow - default level : jf +Journald follow - level crit : jfc +Journald follow - level err : jfe +Journald follow - level warning : jfw + +Journald follow one or more units : jfu ... + +List units in failed state : scf + +Status of unit(s) : scs ... + +Cat systemd unit file : scc ... +"' +################################################################################ + +# Journald from boot +# - default +alias jb="journalctl --boot" +# crit +alias jbc="journalctl --boot --priority=crit" +# err +alias jbe="journalctl --boot --priority=err" +# warning +alias jbw="journalctl --boot --priority=warning" + +# Journald follow +# - default +alias jf="journalctl --follow" +# crit +alias jfc="journalctl --follow --priority=crit" +# err +alias jfe="journalctl --follow --priority=err" +# warning +alias jfw="journalctl --follow --priority=warning" + +# Journald follow one or more units +function jfu(){ + for UNIT in $@; do + UNITS+=" -u $UNIT" + done + journalctl -f $UNITS; +} + +# List units in failed state +alias scf="systemctl list-units --failed" +# Status of unit(s) +function scs(){ systemctl status $@; } +# Cat systemd unit file +function scc(){ systemctl cat $@; } +