From c7d0be4c84207a2d639405ffa1d841c77cc6bee1 Mon Sep 17 00:00:00 2001 From: Matthias Strubel Date: Thu, 7 Jan 2016 07:53:22 +0100 Subject: [PATCH] Added section about USER-run services. Install dedicated server as a User-service. So the rust user itself is able to stop/start an instance without sudo priviledge. --- README | 4 +++- USER.txt | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 USER.txt diff --git a/README b/README index d46280b..a72077b 100644 --- a/README +++ b/README @@ -81,7 +81,9 @@ Enter the following line to manually connect to your server: client.connect : ----- Prepare for automatic startup +---- Prepare for automatic startup as a system service: +(alternatively, see USER.txt) + Create a copy of the service file and adjust it with your script name # cp rust.service rustmyserver.service diff --git a/USER.txt b/USER.txt new file mode 100644 index 0000000..02435e2 --- /dev/null +++ b/USER.txt @@ -0,0 +1,33 @@ +You can also run the rust daemon as a user own process. +This means, that the user itself is able to start/stop the instance without sudo rights. + +Usually user services are started during the first login and stopped when +then last session closes. To prevent this, make the user session available during bootup + + + # su + # loginctl enable-linger rust + # exit + +Create a copy of the service file and adjust it with your script name, +also remove the user & group parameter and change the Wanted By Target: + + # cp rust.service rustmyserver.service + # sed -i -e 's|User=rust||' -e 's|Group=rust||' rustmyserver.service + # sed -i -e 's|multi-user.target|default.target|' rustmyserver.service + # nano rustmyserver.service + +Copy the service file to the systemd user folder: + + # mkdir -p ~/.config/systemd/user/ + # cp rustmyserver.service ~/.config/systemd/user/ + +To enable the Userservice rustmyserver.service for startup run: + + # systemctl --user enable rustmyserver.service + +To start/stop it use: + + # systemctl --user start rustmyserver.service + +