mirror of
https://codeberg.org/andyscott/dotfiles.git
synced 2024-11-08 13:30:47 -05:00
scripts: testing consolidation of commands in river-exit
This commit is contained in:
parent
f31d2436f8
commit
b699d1577a
1 changed files with 34 additions and 19 deletions
|
@ -1,26 +1,41 @@
|
|||
#!/bin/sh
|
||||
|
||||
river=$(ps -C river | awk '/river/')
|
||||
river=$(pgrep -x river)
|
||||
|
||||
if [ -z "$river" ]; then
|
||||
echo "error: $0: River is not running"
|
||||
exit 1
|
||||
elif [ $# -ne 1 ]; then
|
||||
echo "Usage: river-exit [command]"
|
||||
echo "Commands: logout, poweroff, or reboot"
|
||||
exit 1
|
||||
echo "error: $0: River is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "logout" ]; then
|
||||
riverctl spawn 'reset'
|
||||
riverctl exit
|
||||
elif [ "$1" = "poweroff" ]; then
|
||||
riverctl spawn 'reset'
|
||||
loginctl poweroff
|
||||
elif [ "$1" = "reboot" ]; then
|
||||
riverctl spawn 'reset'
|
||||
loginctl reboot
|
||||
else
|
||||
echo "error: $0: unexpected argument"
|
||||
exit 1
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: river-exit [command]"
|
||||
echo "Commands: logout, poweroff, or reboot"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "logout" ] || [ "$1" = "poweroff" ] || [ "$1" = "reboot" ];then
|
||||
riverctl spawn 'reset'
|
||||
|
||||
if [ "$1" = logout ];then
|
||||
riverctl exit
|
||||
elif [ "$1" = poweroff ] || [ "$1" = reboot ];then
|
||||
loginctl "$1"
|
||||
fi
|
||||
else
|
||||
echo "error: $0: unexpected argument"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if [ "$1" = "logout" ]; then
|
||||
# riverctl spawn 'reset'
|
||||
# riverctl exit
|
||||
# elif [ "$1" = "poweroff" ]; then
|
||||
# riverctl spawn 'reset'
|
||||
# loginctl poweroff
|
||||
# elif [ "$1" = "reboot" ]; then
|
||||
# riverctl spawn 'reset'
|
||||
# loginctl reboot
|
||||
# else
|
||||
# echo "error: $0: unexpected argument"
|
||||
# exit 1
|
||||
# fi
|
||||
|
|
Loading…
Reference in a new issue