suspend
A simple utility for send command to a Gnu/Linux device.
It start a http server and you can send command with curl or other tools. Example:
curl -X POST -d "pkey=<my passwrd encoded in md5>" http://192.168.1.8:7070/suspend/suspend_now
[] POST /suspend/poweroff_now
[] POST /suspend/reboot_now
[] POST /suspend/play
[] POST /suspend/pause
[] POST /suspend/stop
[] POST /suspend/next
[] POST /suspend/previous
For encode your password run from terminal
echo -n "mysecret" |md5sum
Please create file /etc/sudoers.d/suspend with this content:
%users ALL = NOPASSWD: /usr/bin/systemctl suspend
%users ALL = NOPASSWD: /usr/bin/systemctl poweroff
%users ALL = NOPASSWD: /usr/bin/systemctl reboot
Then add your user to group "users".
Install playerctl package and run at start suspend with suspend.desktop inside your desktop environment. Edit suspend.desktop according to your needs.
key=<my password encoded in md5sum> ./suspend
Copy the unit file (suspend.service) in /etc/systemd/system. Copy suspend binary in /usr/local/bin/. The run:
sudo systemctl enable --now suspend
In this case only suspend,poweroff and reboot works. If you wants control still mpris player you have to use suspend.desktop file for autostart your X session.
.pobsrc
exclusions.txt(31/03/2026 )
go.mod(01/04/2026 )
go.sum(01/04/2026 )
main.go(01/04/2026 )
makefile(01/04/2026 )
readme.md(01/04/2026 )
suspend.desktop(31/03/2026 )
suspend.service(01/04/2026 )