I have a Minecraft server running on OS Ubuntu Server 20.04.3 with systemd.
I need to create a user called shutdown which, on login (even from ssh) should:
- Run script
shutdownAll - Log out from session
The shutdownAll script should be the following (or equivalent):
systemctl stop minecraft
shutdown +5 "SERVER SHUTDOWN IN 5 MINUTES"
Any ideas to do it?
EDIT: I've thought about using a command as shell, but how do I execute two commands?
shutdownuser's shell's start-up file (like, in~/.bashrc)?systemctlwith sudoer rights so that it can actually stop the service?~/.bashrc, but I had made a script to be run manually. It was in the sudoer file, but didn't recognizesystemctl. Used aCmd_Aliaswith permission for just/sbin/shutdownand/bin/systemctl