Detection steps for crontab scheduled tasks not responding
1. Set rules
To prevent some path errors, use absolute paths
*/1 * * * * /home/anaconda3/bin/python3 home/mysticbiant/code/test.py >>/home/mysticbiant/test.py.log 2>&1 &
2. Check whether crontab is started
(Recommended learning: Linux video Tutorial)
systemctl status crond
If it does not start, search for yourself how to start crontab.
3. Check the crontab log
# 需要切换root才能看到日志 tail -f /var/log/cron
If the log does not start at the corresponding time, there is a problem.
4. Check account permissions and paths
This is the key point. Many novices will make mistakes in this issue. Please read carefully
crontab timing The task planning rules are that one account is independent and each one does not affect the other. For example, root has its own independent scheduled task plan, and the mysticbinary sub-account you created also has its own independent scheduled task plan, so the redirection rule >>out.log you write will be generated under your corresponding account path. For example, if you use root to create a crontab scheduled task, you need to switch to /root/ to view the out.log file.
This article comes from the php Chinese website, linux system tutorial column, welcome to learn!
The above is the detailed content of Detection steps for crontab scheduled tasks not responding. For more information, please follow other related articles on the PHP Chinese website!