-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Prologue | ||
|
||
Systemd is a nice tool to start, stop and restart scripts on your linu machine. If your script crashes or the VPS does a system reboot your scripts will come back online. | ||
In order to use this you need to be on Linux, have systemd, the discord-twitter-bot has been properly installed and it has worked before. | ||
|
||
# Setup | ||
|
||
Copy the dtb.service file and put it to /etc/systemd/system | ||
`cp dtb.service /etc/systemd/system/dtb.service` | ||
|
||
Edit dtb.service | ||
`nano /etc/systemd/system/dtb.service` | ||
|
||
Adjust the `WorkingDirectory` to the path you git cloned the `discord-twitter-bot` folder/repository. | ||
|
||
Adjust the path of your python executable (first parameter of `ExecStart`): | ||
```coffeescript | ||
tin@Riftshadow:~# which python3 | ||
/usr/bin/python3 | ||
tin@Riftshadow:~# which python3.5 | ||
/usr/bin/python3.5 | ||
``` | ||
|
||
Adjust the path to main.py (second parameter of `ExecStart`) | ||
`<...>/discord-twitter-bot/bot/main.py` | ||
|
||
# systemd commands | ||
|
||
```coffeescript | ||
sudo systemctl start dtb.service | ||
sudo systemctl enable dtb.service | ||
sudo systemctl disable dtb.service | ||
sudo systemctl stop dtb.service | ||
sudo systemctl restart dtb.service | ||
``` | ||
|
||
`enable` means that the service is automatically started when your VPS boots up. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=discord-twitter-bot | ||
After=multi-user.target | ||
[Service] | ||
WorkingDirectory=/home/tin/discord-twitter-bot | ||
User=tin | ||
Group=tin | ||
ExecStart=/usr/bin/python3 /home/tin/discord-twitter-bot/bot/main.py | ||
Type=idle | ||
Restart=always | ||
RestartSec=15 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |