linux - How to modify crontab to run python script? -
i using redhat linux platform wondering why when use python script inside crontab run every 2 minutes won't work though when monitor crond logs using tail /etc/sys/cron shows called script , tried add path of python , [ using python2.6 -- path /usr/bin/python2.6 ]
the crontab -e [tried user , root same problem ]
*/2 * * * * /usr/bin/python2.6 fullpath/myscript.py
thank guys , did little research , have found solution , first have test sudo python see if works module , if not have alias sudo put inside /etc/bashrc [ make system wide alias ] , alias sudo='sudo env path=$path ld_library_path=$ld_library_path oracle_home=$oracle_home tns_admin=$tns_admin' have change crontab call script assign these values variables , using source /the script && /usr/bin/python script.py
Comments
Post a Comment