콘텐츠로 건너뛰기

[ Solved ] crontab won’t run python script how to use OS.SYSTEM method

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

 

It’s going to work well now.

Thank you 🙂

 

 

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.

파이썬 자동화 리눅스 httpd restart 자동실행 스크립트

아파치 자동 재시작 스크립트 폴더 남은 시간 계산 확인 python3 script 확장모델

Exit mobile version