45 16 * * * python3.6 /opt/86autosign.py
19 17 * * * /usr/local/lib/python3.6 /opt/test.py
1. How to determine whether Linux is installed with python and its version number
Just type python directly.
Under normal circumstances, Linux will pre-install Python, but this pre-installed Python version is generally very low, and many new Python features are not available, and a newer version must be reinstalled
2, linux view python installation path, version number
Method 1: whereis python
Method 2: which python
3. Install Python under Linux
https://www.cnblogs.com/feng18/p/5854912.html
https://jingyan.baidu.com/article/9c69d48ff52b3f13c9024e3d.html
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
tar Jxvf Python-3.6.4.tar.xz
cd Python-3.6.4
./configure
make && make install
4. How does the Linux system detect that the Cron service is running?
service crond status
5. Scheduled tasks
crontab usage
crontab -e : Modify the crontab file, if the file does not exist, it will be created automatically.
crontab -l : Display the crontab file.
crontab -r : delete the crontab file.
crontab -ir : Alert the user before deleting the crontab file.
Linux system, start, stop, restart crontab service
Case 1: Normal situation (the system has the service command)
Restart the service command: [root@centos6 /]# service crond restart
Start the service command: [root@centos6 /]# service crond start
Stop service command: [root@centos6 /]# service crond stop
Case 2: When the Linux version does not have the service command, use the following command to stop and start:
Stop the service: [root@centos6 /]# /etc/init.d/cron space stop
Start the service: [root@centos6 /]# /etc/init.d/cron space start
Add a scheduled task:
crontab -e, press the 'i' key on the keyboard, the bottom will become INSERT, you can modify
After modification, press the Esc key to enter: wq Enter to save
How to deal with linux timing execution failure
If our timed tasks are set up, but we do not see the execution, we can view them one by one through the following methods
1. Check the status of crontab to see if crontab is enabled
service crond start start
service crond stop stop
service crond restart restart
service crond reload reload
2. Check the timed execution log to see if there is an execution file
cat / var / log / cron
3. Check whether the file has execution permission and whether it uses an absolute path. This is mentioned above.
4. If there is no problem with the above, it is the execution problem of the script. At this time, you need to look at the error log of the execution. This log is generally in /var/spool/mail/. There are generally several user information in this folder. We are generally the root user, so we look at the root information. If you are a different account, you can view other users.
After reading this log, I know where the error is. It turns out that the script execution file needs an absolute path.