Crontab won’t run python script!!
Even if you run the python script directly in crontab, the related problems are the same.
Python’s os.system() method does not work.
If you use the automatic scheduler Crontab using Python, you should use it as below.
How to use OS.SYSTEM() method
1. Create a shell script file.
make shell-script file (execute File)
vi p.sh
sudo /usr/bin/python3 /root/_PYTHON3/memcheck_httpd_restart.py
df -h
2. 755 Provide administrator authority.
chmod 755 p.sh 751 or 755
3. Enter as below using the Crontab-e command.
*/1 * * * * /UserFileForderName/p.sh
![[ Solved ] crontab won't run python script how to use OS.SYSTEM method 4](https://vlog.tion.co.kr/wp-content/uploads/2021/12/566.jpeg)
It’s going to work well now.
Thank you 🙂
![[ Solved ] crontab won't run python script how to use OS.SYSTEM method 5](https://vlog.tion.co.kr/wp-content/uploads/2021/12/315.jpeg)
If you want to make an automatic script using Python, check the post below and follow it.
Look at the first article and install it.
I look at the second article and update it.
![[ Solved ] crontab won't run python script how to use OS.SYSTEM method 2](https://vlog.tion.co.kr/wp-content/uploads/2021/12/789.jpeg)
![[ Solved ] crontab won't run python script how to use OS.SYSTEM method 3](https://vlog.tion.co.kr/wp-content/uploads/2021/12/847.jpeg)