Add systemd and journald aliases

Signed-off-by: Alban Vidal <alban.vidal@zordhak.fr>
This commit is contained in:
Alban Vidal 2018-09-20 07:24:11 +02:00
parent 036339f4ac
commit 9d41d49fb1
2 changed files with 73 additions and 14 deletions

View File

@ -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"

View File

@ -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 <unit1> <unit2> ...
List units in failed state : scf
Status of unit(s) : scs <unit1> <unit2> ...
Cat systemd unit file : scc <unit1> <unit2> ...
"'
################################################################################
# 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 $@; }