robertoszek / pleroma-bot

Bot for mirroring one or multiple Twitter accounts in Pleroma/Mastodon/Misskey.
https://robertoszek.github.io/pleroma-bot
MIT License
104 stars 18 forks source link

Cron on Debian #106

Closed bugsysop closed 1 year ago

bugsysop commented 1 year ago

I had some problem to configure the cron on Debian 11 (bot installed with PyPi).

Solved with complete path to Python and Stork like this:

*/10 * * * * /usr/bin/python /usr/local/bin/pleroma-bot -c /path/to/config.yml -l /path/to/error.log 1> /dev/null

Maybe this information can be somewhere in the documentation

bugsysop commented 1 year ago

Note: In the terminal running pleroma-bot --help is working fine, no need of path...
This problem occurs only when configuring the cronjob

robertoszek commented 1 year ago

Hi! I'm glad you were able to find a workaround! Interesting, I've been using it on Debian 10 as a cronjob too. However I was using a virtual environment, so it's not all that relevant to your issue in particular.

In order to try to properly document this for others that may run into it, could you provide some info for me?

I'm curious, were you editing /etc/crontab directly or running crontab -e as the user that ran the pip install command?

Is there a PATH variable on your crontab and does it differ at all from what you get when running echo $PATH?

Oh, and what's your default python version?

$ which python
$ python --version

Looks like Debian 11 deprecated Python 2 but it says you can restore the /usr/bin/python symlink by installing either the python-is-python3 or python-is-python2 packages.

Perhaps the default in your system is Python 2 and the cron job is getting confused trying to find the pleroma-bot package, which was installed using Python 3.

bugsysop commented 1 year ago

Infos on Python:

/usr/bin/python
Python 3.9.2

This the default Python version on my system I used pip3 command to install the bot

Result of $PATH:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

I created and edited crontab with this command:

crontab -e

Hope this help

robertoszek commented 1 year ago

Thank you! I've added a note mentioning this on the README and on the Cron section of the documentation: https://robertoszek.github.io/pleroma-bot/gettingstarted/automateit/#cron

NOTE: If you have issues with cron running the bot you may have to specify the full path of your Python executable */10 * * * * /usr/bin/python /usr/local/bin/pleroma-bot

robertoszek commented 1 year ago

Let me know if you run into any other trouble! I'll close this for now.

Feel free to re-open this or open a new issue if needed, have a nice day!