Skip to content

Commit

Permalink
Added section about USER-run services.
Browse files Browse the repository at this point in the history
Install dedicated server as a User-service. So the rust user itself
is able to stop/start an instance without sudo priviledge.
  • Loading branch information
MaStr committed Jan 7, 2016
1 parent 1342f34 commit c7d0be4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ Enter the following line to manually connect to your server:
client.connect <ip>:<port>


---- 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
Expand Down
33 changes: 33 additions & 0 deletions USER.txt
Original file line number Diff line number Diff line change
@@ -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


0 comments on commit c7d0be4

Please sign in to comment.