mirror of
https://codeberg.org/andyscott/dotfiles.git
synced 2024-11-09 22:10:48 -05:00
26 lines
524 B
Bash
26 lines
524 B
Bash
#!/bin/sh
|
|
|
|
river=$(ps -C river | awk '/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
|
|
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
|