iankelling.org
/
git
/
distro-setup
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
show hostname in prompt whenever sudo
[distro-setup]
/
brc
diff --git
a/brc
b/brc
index 1c93c8adbcf4fbee67b23c573428477c4bc92259..e03b0b5dc2afbf86be8a89183197c701d33a6aeb 100644
(file)
--- a/
brc
+++ b/
brc
@@
-167,6
+167,7
@@
C_DEFAULT_DIR=/a
# https://superuser.com/questions/366930/how-do-i-get-the-git-pager-to-clean-up-screen-output-after-exit
# and reading the man
export LESS=RXi
# https://superuser.com/questions/366930/how-do-i-get-the-git-pager-to-clean-up-screen-output-after-exit
# and reading the man
export LESS=RXi
+export SYSTEMD_LESS=$LESS
# * include files
for _x in /a/bin/distro-functions/src/* /a/bin/!(githtml)/*-function?(s); do
# * include files
for _x in /a/bin/distro-functions/src/* /a/bin/!(githtml)/*-function?(s); do
@@
-340,9
+341,21
@@
b() {
}
bbk() {
}
bbk() {
+ c /
+ local active=true
+ if systemctl is-active btrbk.service; then
+ echo "cron btrbk is already running"
+ return 1
+ fi
+ systemctl is-active btrbk.timer || active=false
+ if $active; then
+ ser disable btrbk.timer
+ fi
# run latest
install-my-scripts
# run latest
install-my-scripts
- btrbk-run "$@"
+ if ! btrbk-run "$@" && $active; then
+ ser enable btrbk.timer
+ fi
}
bfg() { java -jar /a/opt/bfg-1.12.14.jar "$@"; }
}
bfg() { java -jar /a/opt/bfg-1.12.14.jar "$@"; }
@@
-351,19
+364,11
@@
bigclock() {
xclock -digital -update 1 -face 'arial black-80:bold'
}
xclock -digital -update 1 -face 'arial black-80:bold'
}
-bpush() {
- case $HOSTNAME in
- tp) target=x2 ;;
- x2) target=tp ;;
- esac
- btrbk-run -t $target && switch-mail-host $HOSTNAME $target
-}
bpull() {
bpull() {
- case $HOSTNAME in
- tp) source=x2 ;;
- x2) source=tp ;;
- esac
- btrbk-run -s $source && switch-mail-host $source $HOSTNAME
+ c /
+ # run latest
+ install-my-scripts
+ switch-mail-host $1 $HOSTNAMEs
}
btc() {
}
btc() {
@@
-1085,23
+1090,20
@@
ipdrop() {
s iptables -A INPUT -s $1 -j DROP
}
s iptables -A INPUT -s $1 -j DROP
}
-net-dev-info() {
- e "lspci -nnk|gr -iA2 net"
- lspci -nnk|gr -iA2 net
- hr
- e "s lshw -C network"
- hr
- s lshw -C network
-
-}
istext() {
grep -Il "" "$@" &>/dev/null
}
istext() {
grep -Il "" "$@" &>/dev/null
}
+jfilter() {
+ grep -Evi -e "^(\S+\s+){4}(sudo|sshd|cron)\[\S*:" \
+ -e "^(\S+\s+){4}systemd\[\S*: (starting|started) (btrfsmaintstop|dynamicipupdate|spamd dns bug fix cronjob|rss2email)\.*$"
+}
jtail() {
jtail() {
- journalctl -n 10000 -f "$@" |
grep -Evi "^(\S+\s+){4}(sudo|sshd|cron)"
+ journalctl -n 10000 -f "$@" |
jfilter
}
}
+jr() { journalctl "$@" | jfilter | less ; }
+jrf() { journalctl -f "$@" | jfilter; }
kff() { # keyboardio firmware flash
pushd /a/bin/distro-setup/Arduino/Model01-Firmware
kff() { # keyboardio firmware flash
pushd /a/bin/distro-setup/Arduino/Model01-Firmware
@@
-1239,6
+1241,15
@@
mkdir() { command mkdir -p "$@"; }
mo() { xset dpms force off; } # monitor off
mo() { xset dpms force off; } # monitor off
+net-dev-info() {
+ e "lspci -nnk|gr -iA2 net"
+ lspci -nnk|gr -iA2 net
+ hr
+ e "s lshw -C network"
+ hr
+ s lshw -C network
+
+}
nopanic() {
sudo tee -a /var/log/exim4/paniclog-archive </var/log/exim4/paniclog; sudo truncate -s0 /var/log/exim4/paniclog
nopanic() {
sudo tee -a /var/log/exim4/paniclog-archive </var/log/exim4/paniclog; sudo truncate -s0 /var/log/exim4/paniclog
@@
-1484,7
+1495,7
@@
scssl() {
}
ser() {
}
ser() {
- local s; [[ $EUID != 0 ]] && s=s
udo
+ local s; [[ $EUID != 0 ]] && s=s
if type -p systemctl &>/dev/null; then
$s systemctl $1 $2
else
if type -p systemctl &>/dev/null; then
$s systemctl $1 $2
else
@@
-2078,13
+2089,10
@@
if [[ $- == *i* ]]; then
bind -m vi-command W:shell-forward-word
fi
bind -m vi-command W:shell-forward-word
fi
- if [[ $SSH_CLIENT ]]; then
+ if [[ $SSH_CLIENT
|| $SUDO_USER
]]; then
PS1="\h $PS1"
fi
PS1="\h $PS1"
fi
-
-
-
prompt-command() {
local return=$? # this MUST COME FIRST
local psc pst ps_char ps_color stale_subvol
prompt-command() {
local return=$? # this MUST COME FIRST
local psc pst ps_char ps_color stale_subvol