EDITED:
I got a script running with a cronjob every day at 1 am:
0 1 * * * /bin/bash /home/performanceRatio.sh
It also appears in the cron.log:
Feb 2 01:00:01 inf-education-67 CRON[108963]: (root) CMD (bash performanceRatio.sh)
Feb 2 01:00:01 inf-education-67 CRON[108962]: (CRON) info (No MTA installed, discarding output)
Expected behavior is to update a mysql database. Changes appear if it's run manually.
Using Ubuntu 20.04
My script looks like:
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
python3 get_weather_data_crn.py && python3 pv.py
* * * * * env > /tmp/env.output
shows:
HOME=/root
LOGNAME=root
PATH=/usr/bin:/bin
LANG=de_DE.UTF-8
SHELL=/bin/sh
PWD=/root
/usr/bin/bash
– Feb 03 '21 at 07:35performanceRatio.sh
unless it's located in theHOME
of the user whose crontab the job is in ... you should not need the full path tobash
since/bin
and/usr/bin
are in the default cronPATH
. However you wouldn't needbash
at all if you use an appropriate shebang in your script and make it executable. – steeldriver Feb 03 '21 at 13:49/home/performanceRatio.sh
?? – Artur Meinild Feb 04 '21 at 10:08get_weather_data_crn.py
andpv.py
? Are they also in/home
? Because I can't see/home
anywhere in your path. You need to reference full path for python scripts also. – Artur Meinild Feb 04 '21 at 10:53python3 /home/get_weather_data_crn.py && /home/python3 pv.py
– why me Feb 04 '21 at 10:55python3 /home/get_weather_data_crn.py && python3 /home/pv.py
– Artur Meinild Feb 04 '21 at 11:11env > /tmp/env.output
inside the sh file and it did the jib. But the Python scripts weon't run.. – why me Feb 04 '21 at 11:25