Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1264

Python • Re: Cron job for discord.py python script

$
0
0
I actually just did nearly exactly this though with venv. However I am running into an issue where the service finishes executing after 1/10th of a second under a SUCESS status.
Assuming no errors are logged (check "systemctl status mybot.service", the systemd journal with journalctl, and any logs from your code), it's possible that the bot framework you are using is automatically daemonizing itself (i.e. forking a daemon instance, then exiting the parent process). That's a fairly common old-school behaviour for Linux services, kinda pre-systemd. If that's the case, you can either tell it not to daemonize (i.e. run in foreground), or systemd can deal with that with something like this in your service file:

Code:

[Service]Type=forkingPIDFile=/run/discord-bot.pidExecStart=/usr/local/lib/discord-bot
Another possibility is that you need to run it as a particular user, which can be done with "User=username" in the Service section.

Statistics: Posted by Murph9000 — Fri Aug 30, 2024 11:45 am



Viewing all articles
Browse latest Browse all 1264

Trending Articles