I have a script web.py which I am trying to run on the aws EC2 Instance using cron. It basically has these line of codes:
import webbrowser
webbrowser.open(')If I run this script through putty using "python web.py" it does hit the browser. But same is not working if I run it via cron. My cron code is :
*/10 * * * * /usr/bin/python /home/web.pyThe way I know its not working is there are few process which get executed once the url is hit. I can see those changes when I run the script through putty but not when I run it through cron.
I tried below modifications also but its not working.
*/10 * * * * export DISPLAY=:0 && /usr/bin/python /home/web.py
*/10 * * * * DISPLAY=:0 /usr/bin/python /home/web.pyAlso on echo $DISPLAY I get a null result. Any help would be appreciated.
21 Answer
Adding a semicolon worked for me:
*/10 * * * * export DISPLAY=:0; /usr/bin/python /home/web.py