reactiflux / discord-irc

Connects Discord and IRC channels by sending messages back and forth.
MIT License
1.2k stars 293 forks source link

how to deamonize? #617

Open radmx opened 2 years ago

radmx commented 2 years ago

pm2 looks tricky, can anyone daemonize discord-irc on a different way ?

regards

radmx commented 2 years ago

i've found the solution inspired on this issue

https://github.com/reactiflux/discord-irc/issues/604 <--al credits goes to this guy

but the code has to change on the discord-irc.service

solution for debian boxes

Note: i've downloaded and install on /root/discord-irc and my config.json is inside this folder

here the steps

1.- create discord-irc.service with nano on /etc/systemd/system:

] nano /etc/systemd/system/discord-irc.service

paste like this on editor:

[Unit]
Description=Discord IRC bridge

[Service]
Restart=always
RestartSec=5s
User=root
Type=simple
ExecStart=/usr/local/bin/discord-irc --config /root/discord-irc/config.json

[Install]
WantedBy=multi-user.target

save ( ctrl+x and ctrl +o)

run:
systemctl daemon-reload systemctl enable discord-irc systemctl start discord-irc

once again, i installed discord-irc as root, probably file path's can change if you install on other user, this is not been confirmed at this point

and there you go!

notvillers commented 1 year ago

I think you should add Requires=network-online.target After=network-online.target in the [Unit] after Description=Discord IRC bridge so it will only run if you have internet connection.