I've been having issues lately with a cron script that has been running for a long time and suddenly stopped working. The script runs on root crontab. The organization is as follows:
- In the crontab i execute a
run_script.sh
script - Inside the .sh script i execute cd to a specific directory and then execute
pipenv run python script.py
The run_script.sh
works correctly if manually executed, but when is triggered by cron it returns an error of importing a library which is present in python3 (the script.py is written in python3) but not in python2. So i assume that for some reason there's gotta be a problem when setting up the venv using pipenv even though the logs only show an import library error.
I've tried changing the run_script.sh
to pipenv run python3 script.py
and still got the same error log.
Also tried setting the PATH env in both the cron file and the run_script.sh
adding the path to python3 to the existing PATH and that didn't work for me neither.
Lastly i sudo apt update && upgrade
the machine and still the script doesn't work.
Here are the outputs of uname -a
and lsb_release -a
:
Linux ubuntu 5.7.0-2-amd64 #1 SMP Debian 5.7.10-1 (2020-07-26) x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Thanks in advance!