These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Run python in Cron Job on the new forum.
Hello,
is it possible to run python file (.py) in cron job?? if yes, then can you provide the syntex which i have to follow to make it run in virtualmin??
I am trying to run job by using python script.... it will check some status in multiple tables and sends emails based on conditions....
need help in configuring it in Virtualmin.
or if Virtualmin have any setup already then please let me know....
Regards Praveen
hi, well python can run outside of anything...just run the cron job as usual in any linux distro, precisely said, you dont even need virtualmin to run your crons.. regards how to run it, google is flooded with info.
Configuring/troubleshooting Debian servers is always great fun
Hi Unborn,
thanks for the info....
I am trying to use webmin feature of scheduling cron job as per below link. https://www.virtualmin.com/documentation/tutorial/how-to-setup-a-cron-job
I created job and executed by clicking "Run Now" button and everything worked well, but when I scheduled it to run... its not working.... in the commend field I just placed like this - > python \folder1\folder2\file.py... (as i said when I run immediately it works great...)
what I am doing wrong here....
Regards Praveen
Hi Praveen,
I would check the user you running the cron job under.. it should be domain owner (try to avoid root user unless you have to run that job under root user). also you can explicitly use
/usr/bin/python
in your crontb command... aka:/usr/bin/python /path/to/your/script.py
- that should make it working.. also check your shebang but, I guess it is correct.Edit: attaching screenshot how might simple cron job schedule looks like in virtualmin... (working one)
- full size: https://i.imgur.com/Q4NYtQV.png
Configuring/troubleshooting Debian servers is always great fun
Thank you...
that helped...
Providing full path of python resolved issue....
Regards Praveen
@pratam02
Configuring/troubleshooting Debian servers is always great fun