First tested something simple like this, which works:
* * * * * echo "something" > /Users/sam/Desktop/vscode/crontest.txt
Now trying
28 10 * * * /Users/user/Desktop/work/venv/bin/python /Users/user/Desktop/work/py_files/test.py
But nothing is happening.
The python script ingests some data from API, parses JSON and outputs to a local mysql db
engine_insert = sqlalchemy.create_engine('mysql+pymysql://root:password@127.0.0.1:3306/database')
df.to_sql('database', engine_insert, if_exists='append', index=False)
But other simpler crons I also had issue with too like opening a website via browser so may just be a syntax issue with crontab?
I faced the same issue and I spent literally days to see where is my problem. So, try two things:
1- Follow these steps/instructions: https://stackoverflow.com/a/22744360/2080489
2- If you still facing the issue, try to stop any security module you have that might affect the connection. In my case, I am using Ubuntu so I stoped AppAromr:
sudo systemctl stop apparmor
or in case you want to disable it
sudo systemctl disable apparmor
check the app status by doing:
sudo systemctl status apparmor
Hope this would help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.