shell-base/modules/systemd.lib

52 lines
1.3 KiB
Bash

#!/bin/bash
function sdj(){
journalctl -u "$1" | tail -f -n ${2:-50}
}
function sdjf(){
journalctl -f -u "$1"
}
function sdw(){
sdst "$1" | grep Loaded
}
function sdstate () {
echo $1 state
systemctl show --no-page $1 | grep ActiveState
systemctl show --no-page $1 | grep UnitFileState
systemctl show --no-page $1 | grep LoadState
systemctl show --no-page $1 | grep ExecMainPID
systemctl show --no-page $1 | grep ExecMainStartTimestamp=
systemctl show --no-page $1 | grep ExecMainExitTimestamp=
}
function sdju(){
journalctl --user -u "$1" | tail -f -n ${2:-50}
}
function sdjuf(){
journalctl --user -f -u "$1"
}
function sdwu(){
sdstu "$1" | grep Loaded
}
function sdstateu () {
echo $1 state
systemctl --user show --no-page $1 | grep ActiveState
systemctl --user show --no-page $1 | grep UnitFileState
systemctl --user show --no-page $1 | grep LoadState
systemctl --user show --no-page $1 | grep ExecMainPID
systemctl --user show --no-page $1 | grep ExecMainStartTimestamp=
systemctl --user show --no-page $1 | grep ExecMainExitTimestamp=
}
function sdeub {
loginctl enable-linger
}
function sddub {
loginctl disable-linger
}
function sdstub {
[[ $(loginctl show-user "$USER" --property=Linger | cut -d= -f2) == 'yes' ]] && echo enabled || echo disabled
}