aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2017-02-17 17:32:25 +0100
committerDavid Runge <dave@sleepmap.de>2017-02-17 17:32:25 +0100
commitdfd632999b12611d930b5ca6cd286bb511fff082 (patch)
treef0051a91cc1f0ffb099b5a89fcc619b9afc39651
parent89188f0a9cbb11e9ead704d4fba434f0378c4f30 (diff)
downloaddotfiles-dfd632999b12611d930b5ca6cd286bb511fff082.tar.gz
dotfiles-dfd632999b12611d930b5ca6cd286bb511fff082.tar.bz2
dotfiles-dfd632999b12611d930b5ca6cd286bb511fff082.tar.xz
dotfiles-dfd632999b12611d930b5ca6cd286bb511fff082.zip
.zsh.after/functions.zsh: Adding new functions for journalctl.
-rw-r--r--.zsh.after/functions.zsh84
1 files changed, 84 insertions, 0 deletions
diff --git a/.zsh.after/functions.zsh b/.zsh.after/functions.zsh
index ecfc936..5be8e73 100644
--- a/.zsh.after/functions.zsh
+++ b/.zsh.after/functions.zsh
@@ -235,5 +235,89 @@ backupfolder() {
--delete --ignore-existing --size-only -s --exclude 'lost+found' --exclude '.Trash-1000' --exclude '$RECYCLEBIN' --exclude 'System Volume Information' --exclude '.thumbs' $1 $2
}
+# journalctl
+
+# show messages of specified system units
+function sdsjfu(){
+ local journal_cmd="sudo journalctl --system -a"
+ eval ${journal_cmd} $(echo $@ | sed 's/\ /\ -u\ /g; s/^/\ -u\ /')
+}
+
+# follow messages of specified system units
+function sdsjfu(){
+ local journal_cmd="sudo journalctl --system -af"
+ eval ${journal_cmd} $(echo $@ | sed 's/\ /\ -u\ /g; s/^/\ -u\ /')
+}
+
+# follow messages of specified system units for this boot
+function sdsjbfu(){
+ local journal_cmd="sudo journalctl --system -b -af"
+ eval ${journal_cmd} $(echo $@ | sed 's/\ /\ -u\ /g; s/^/\ -u\ /')
+}
+
+# follow messages of specified user units
+function sdujfu(){
+ local journal_cmd="journalctl --user -af"
+ eval ${journal_cmd} $(echo $@ | sed 's/\ /\ --user-unit\ /g; s/^/\ --user-unit\ /')
+}
+
+# follow messages of specified user units for this boot
+function sdujbu(){
+ local journal_cmd="journalctl --user -a -b"
+ #TODO: Check if first argument is a number, then use it for -b
+ eval ${journal_cmd} $(echo $@ | sed 's/\ /\ --user-unit\ /g')
+}
+
+# show messages of specified system units since and until a specified time
+function sdsjSUu(){
+ local journal_cmd="sudo journalctl --system -a -S"
+ local args=(${@})
+ journal_cmd="$journal_cmd $args[1] -U $args[2]"
+ args=(${args:2})
+ eval ${journal_cmd} $(echo $args | sed 's/\ /\ -u\ /g; s/^/\ -u\ /')
+}
+
+# show messages of specified system units since a specified time
+function sdsjSu(){
+ local journal_cmd="sudo journalctl --system -a -S"
+ local args=(${@})
+ journal_cmd="$journal_cmd $args[1]"
+ args=(${args:1})
+ eval ${journal_cmd} $(echo $args | sed 's/\ /\ -u\ /g; s/^/\ -u\ /')
+}
+
+# show messages of specified user units since and until a specified time
+function sdujSUu(){
+ local journal_cmd="journalctl --user -a -S"
+ local args=(${@})
+ journal_cmd="$journal_cmd $args[1] -U $args[2]"
+ args=(${args:2})
+ eval ${journal_cmd} $(echo $args | sed 's/\ /\ --user-unit\ /g; s/^/\ --user-unit\ /')
+}
+
+# show messages of specified user units since a specified time
+function sdujSu(){
+ local journal_cmd="journalctl --user -a -S"
+ local args=(${@})
+ journal_cmd="$journal_cmd $args[1]"
+ args=(${args:1})
+ eval ${journal_cmd} $(echo $args | sed 's/\ /\ --user-unit\ /g; s/^/\ --user-unit\ /')
+}
+
+# show kernel messages since and until a specified time
+function sdsjkSU(){
+ local journal_cmd="sudo journalctl --system -a -k -S"
+ local args=(${@})
+ journal_cmd="$journal_cmd $args[1] -U $args[2]"
+ eval ${journal_cmd}
+}
+
+# show kernel messages since a specified time
+function sdsjkS(){
+ local journal_cmd="sudo journalctl --system -a -k -S"
+ local args=(${@})
+ journal_cmd="$journal_cmd $args[1]"
+ eval ${journal_cmd}
+}
# FUNCTIONS >