I'm newbie making cronjobs with linux. My goal is to execute a python script in its own virtual enviroment.
To do this I have made first a shell script called twitter.sh where its content is:
source /home/josecarlos/Workspace/python/robot2-rss/venv/bin/activate
python /home/josecarlos/Workspace/python/robot2-rss/main.py R,1
And its route is:
/home/josecarlos/Workspace/python/robot2-rss
We have access to source and python commands due their routes /usr/bin are included in the PATH variable as you can see in the next image:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
The config of my cronjob is:
# m h dom mon dow command
*/1 * * * * /home/josecarlos/Workspace/python/robot2-rss/twitter.sh
However, this configuration of my cron job doesn't works and I don't know what am I doing wrong :(
Edit I:
I have modified my twitter.sh script to this new code:
#!/bin/sh
/home/josecarlos/Workspace/python/robot2-rss/venv/bin/python /home/josecarlos/Workspace/python/robot2-rss/main.py R,1
If I run the script directly works fine but with the cron job doesn't work!!! :(
Edit II:
How in the last modification from twitter.sh I just only was calling to my python script, I have modified my cron job to call directly to the python script like this:
# m h dom mon dow command
* * * * * /home/josecarlos/Workspace/python/robot2-rss/venv/bin/python /home/josecarlos/Workspace/python/robot2-rss/main.py R,1
And it doesn't work :( I don't know what happen :(