„README.md“ ändern
This commit is contained in:
parent
fb1aeff33c
commit
555b560a29
52
README.md
52
README.md
|
|
@ -9,29 +9,7 @@
|
|||
## Installation
|
||||
|
||||
- Just clone the repository to wherever you like
|
||||
|
||||
### (optional) Setting up systemd user service
|
||||
|
||||
Systemd only allows system wide services out of the box. Those require root access though.
|
||||
If you don't wanna run the bot on an account with root access, here's what you can do:
|
||||
|
||||
On an account with root access run:
|
||||
|
||||
```
|
||||
loginctl enable-linger <username>
|
||||
export XDG_RUNTIME_DIR=/run/user/$(id -u)
|
||||
```
|
||||
|
||||
Reboot your system and log in to the non-root account.
|
||||
|
||||
Afterwards you have to check two environment variables:
|
||||
```
|
||||
echo $XDB_RUNTIME_DIR // should return something like /run/user/1001
|
||||
echo $DBUS_SESSION_BUS_ADDRESS // should return something like /run/user/1001/bus
|
||||
```
|
||||
|
||||
Now you can create user services under /home/\<username\>/.config/systemd/user.
|
||||
The bot service should look something like this:
|
||||
- If you run systemd, create a service. For example:
|
||||
```
|
||||
# discord-bot.service
|
||||
|
||||
|
|
@ -47,6 +25,34 @@ ExecStart=/usr/bin/python3.10 /home/marco/Projects/DiscordBot/bot.py
|
|||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
- If you don't run systemd, you have to edit the update script to something like
|
||||
```
|
||||
pkill -f 'bot.py'
|
||||
git pull origin master
|
||||
python3 bot.py
|
||||
```
|
||||
|
||||
### (optional) Setting up systemd user service
|
||||
|
||||
Systemd only allows system wide services out of the box. Those require root access though.
|
||||
If you don't wanna run the bot on an account with root access, here's what you can do:
|
||||
|
||||
On an account with root access run:
|
||||
|
||||
```
|
||||
loginctl enable-linger <username> // This will enable a user specific service manager
|
||||
```
|
||||
More on that [here](https://www.freedesktop.org/software/systemd/man/loginctl.html#enable-linger%20USER%E2%80%A6).
|
||||
|
||||
Now reboot your system and log in to the non-root account.
|
||||
|
||||
You have to check two environment variables:
|
||||
```
|
||||
echo $XDB_RUNTIME_DIR // should return something like /run/user/1001
|
||||
echo $DBUS_SESSION_BUS_ADDRESS // should return something like /run/user/1001/bus
|
||||
```
|
||||
|
||||
Now you can create user services under /home/\<username\>/.config/systemd/user.
|
||||
|
||||
To control the service you then can do:
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user