Reputation: 127
I have a crontab like this. the python script will send a message to my phone. when I execute '/usr/local/bin/python /home/work/alibaba-rocketmq/monitor/monitor.py ' on the command line,I can get the message. but in the crontab . It doesnot work.
why. Thanks for your help
* * * * * /usr/local/bin/python /home/work/alibaba-rocketmq/monitor/monitor.py
Upvotes: 1
Views: 105
Reputation: 1323223
You could use another approach and:
Put your script in a file foo.py starting with
#!/usr/local/bin/python
Make sure you give execute permission to that script:
chmod a+x /home/work/alibaba-rocketmq/monitor/monitor.py
use only /home/work/alibaba-rocketmq/monitor/monitor.py
in your crontab file.
Upvotes: 1