add sudo to aliases if not root

This commit is contained in:
Jakobus Schürz 2020-01-20 12:18:45 +01:00
parent 484b08ea80
commit 06f1931df5

21
aliases
View file

@ -119,13 +119,13 @@ alias rock64='sudo minicom -D /dev/ttyUSB0 --color=on'
alias rock64='sudo minicom -D /dev/ttyUSB0 -b 1500000--color=on'
# openvpn
alias ovpnrestart='sudo systemctl restart openvpn-client@${HOSTNAME}.service'
alias ovpnstart='sudo systemctl start openvpn-client@${HOSTNAME}.service'
alias ovpnstatus='sudo systemctl status openvpn-client@${HOSTNAME}.service'
alias ovpnstop='sudo systemctl stop openvpn-client@${HOSTNAME}.service'
alias ovpnrestart='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl restart openvpn-client@${HOSTNAME}.service'
alias ovpnstart='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl start openvpn-client@${HOSTNAME}.service'
alias ovpnstatus='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl status openvpn-client@${HOSTNAME}.service'
alias ovpnstop='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl stop openvpn-client@${HOSTNAME}.service'
# systemd
alias scdr='systemctl --system daemon-reload'
alias scdr='systemctl daemon-reload'
alias scpo='systemctl poweroff'
alias scrb='systemctl reboot'
alias scrl='systemctl reload'
@ -134,7 +134,16 @@ alias scs='systemctl start'
alias scstp='systemctl stop'
alias scst='systemctl status'
alias sc='systemctl'
alias sda='systemd-analyze plot > /tmp/bootchart.svg && eog /tmp/bootchart.svg&'
alias sscdr='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl daemon-reload'
alias sscpo='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl poweroff'
alias sscrb='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl reboot'
alias sscrl='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl reload'
alias sscrs='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl restart'
alias sscs='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl start'
alias sscstp='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl stop'
alias sscst='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl status'
alias ssc='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl'
alias sda='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemd-analyze plot > /tmp/bootchart.svg && eog /tmp/bootchart.svg&'
# remote control
alias virgooff='ssh virgo sudo systemctl poweroff'