Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create systemd Service #9

Open
antonizoon opened this issue Mar 7, 2016 · 2 comments
Open

Create systemd Service #9

antonizoon opened this issue Mar 7, 2016 · 2 comments
Assignees

Comments

@antonizoon
Copy link
Member

antonizoon commented Mar 7, 2016

I've created an impromptu systemd service for itabashi to use:

It requires the user itabashi to be created on the system, with this git repo cloned into /home/itabashi/itabashi. Then it runs the the bot under the virtualenv using service.sh:

However, it's not altogether elegant. Maybe there could be an installation script and such. But either way it works for now.

/etc/systemd/system/itabashi.service

[Unit]
Description=Itabashi Discord/IRC Bridge
After=multi-user.target

[Service]
ExecStart=/home/itabashi/itabashi/service.sh

WorkingDirectory=/home/itabashi/itabashi/

User=itabashi
Group=itabashi

[Install]
WantedBy=multi-user.target

/home/itabashi/itabashi/service.sh

source env/bin/activate
python3 startlink.py connect
@antonizoon
Copy link
Member Author

Sometimes itabashi will just fail inexplicably every few days, for some unknown reason relating to async.io and Discord.py. Restarting the service will work fine, and eventually it meets this problem.

For now, we will just tell Systemd to immediately restart the service upon any failure. it's not perfect but Itabashi works fine nevertheless.

https://jonarcher.info/2015/08/ensure-systemd-services-restart-on-failure/

@DanielOaks
Copy link
Contributor

I wonder whether the process actually exits in those cases where it fails... anyway, we'll see how this goes in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants