I have a python script that I need to run from crontab routing all traffic via a HTTP proxy.
I have already set the proxy in
http_proxy=http://192.168.0.1:3128 # (Address changed for privacy) https_proxy=http://192.168.0.1:3128 export http_proxy export https_proxy
Of course this works fine if I run myscript.py from terminal but when adding the job to crontab it reverts to using standard server IP upon running.
What is the safest way to assure the proxy is used by any python script run from cron? I did find one mention of adding
to the top of the crontab. This seems to work when testing with a simple python script to ping an IP checker website, but is it the safest way?
There is no documentation on this other than one old post I found.