need to add
#!/usr/bin/env python3
at top of python file
make .py file accesiable:
sudo chmod +x my_script.py
then to edit cron job
crontab -e
exec python every hour:
0 * * * * cd /medcheck/medcheck && ./check_for_updates.py >> /medcheck/medcheck/cron.log 2>&1
every minute:
* * * * * cd /medcheck/medcheck && ./check_for_updates.py >> /medcheck/medcheck/cron.log 2>&1
>> /medcheck/medcheck/cron.log 2>&1
//saves log to cron.log
cd /medcheck/medcheck && ./check_for_updates.py
// cd to dir then run the py script
sources:
https://www.howtogeek.com/101288/how-to-schedule-tasks-on-linux-an-introduction-to-crontab-files/
https://www.geeksforgeeks.org/how-to-schedule-python-scripts-as-cron-jobs-with-crontab/
cron with path (envs) working:
15 16 * * * export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin && cd /forsenmcv3 && ./forsen_mc3.py >> /forsenmcv3/cron.log 2>&1