You are not logged in.
Pages: 1
Basically i have a minecraft server that i run as a systemd service but i don't want to actually log into the game everytime i might want to change something with a command is it possible?
This is the current service file i have at the moment
[Unit]
Description=Minecraft Server
After=network.target
[Service]
Type=simple
Restart=always
User=iulian
ExecStart=/home/iulian/server/start.sh
WorkingDirectory=/home/iulian/server/
[Install]
WantedBy=multi-user.targetOffline
simple answer is no, all systemd is doing is running your script which starts the server, you still have to interface with the game server as normal.
Offline
Actually the simple answer is yes, you can pass a single argument to service files designed to accept one:
It is possible for systemd services to take a single argument via the "service@argument.service" syntax. Such services are called "instantiated" services, while the unit definition without the argument parameter is called a "template". An example could be a dhcpcd@.service service template which takes a network interface as a parameter to form an instantiated service. Within the service file, this parameter or "instance name" can be accessed with %-specifiers. See systemd.unit(5) for details.
But depending on the goals, it may be better to use a config file that is read when the service is (re)started. This file could be edited as needed prior to restarting. Reflector is one tool / package I know off the top of my head that does this.
Last edited by Trilby (2022-10-14 13:14:25)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Inofficial first vice president of the Rust Evangelism Strike Force
Offline
hes talking about interfacing with a running server though, at least thats how i read it
EDIT: too slow, yip rcon sounds good, remember using that for cs 1.5 server years ago
Last edited by jonno2002 (2022-10-14 13:22:31)
Offline
In that case the question has nothing to do with systemd services. If the question is "can you give input to a process started by systemd" then the answer is still "yes", but it entirely depends on whether or not said process actually accepts any input - but that has nothing to do with systemd services.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
yes i want to give input to a server that is started by systemd
Offline
But the fact that the server was / is started by a systemd service has no relevance on that question. The answer is no different than if it were started via another service manager, or manually on the command line. If the question is "can I send commands to a running minecraft server" then it looks like Schard's answer is right on point - but if more input is needed, adjusting your title to highlight the actual question may be helpful. You don't need help with systemd services, you need help with a minecraft server.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Pages: 1