Preface This article mainly introduces the relevant content about CentOS7 executing PHP scheduled tasks, and shares it for your reference and learning. Let's take a look at the detailed introduction. 1. Install crontab in CentOS 7: yum install crontabs grammar: crontab [-u <username>][configuration file] or crontab [-u <username>][-elr] parameter:
For more information about how to use the Crontab command, please refer to this article: https://www.jb51.net/article/148575.htm 1. Enter in the command line: crontab -e Then add the corresponding tasks, save and exit with wq; 2. Find the PHP execution directory: which php 3. Execution script format * * * * * /usr/local/php/bin/php /var/www/aaa.php 4. Service Status systemctl start crond.service systemctl stop crond.service systemctl restart crond.service systemctl reload crond.service systemctl enable crond.service ##Set cron to start at boot crontab -l ##View the current cron crontab -e ##Edit the current cron crontab -r ##Delete the current cron 2. Practical Examples Parameter Description
30 21 * * * /etc/init.d/nginx restart ##Restart nginx at 21:30 every night. 45 4 1,10,22 * * /etc/init.d/nginx restart ##Restart nginx at 4:45 on the 1st, 10th, and 22nd of each month. 10 1 * * 6,0 /etc/init.d/nginx restart ##Restart nginx at 1:10 every Saturday and Sunday. 0,30 18-23 * * * /etc/init.d/nginx restart ##Restart nginx every 30 minutes between 18:00 and 23:00 every day. 0 23 * * 6 /etc/init.d/nginx restart ##Restart nginx at 11:00 pm every Saturday. * */1 * * * /etc/init.d/nginx restart ##Restart nginx every hour * 23-7/1 * * * /etc/init.d/nginx restart ##Restart nginx every hour between 11pm and 7am 0 11 4 * mon-wed /etc/init.d/nginx restart ##Restart nginx on the 4th of each month and at 11:00 every Monday to Wednesday 0 4 1 jan * /etc/init.d/nginx restart ##Restart nginx at 4:00 on January 1st */30 * * * * /usr/sbin/ntpdate 210.72.145.20 ##Synchronize time every half hour Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. You may also be interested in:
|
>>: Learn the black technology of union all usage in MySQL 5.7 in 5 minutes
Effect: <div class="imgs"> <!-...
How to solve the problem of being unable to acces...
Recently, the Vue project needs to refresh the da...
If you want to display extra text as ellipsis in ...
How to install and configure MySQL on Mac OS 10.1...
Since there is a button in my company's produ...
<br />Conditional comments are a feature uni...
1) Scope of application: readonly:input[type="...
This article example shares the specific code of ...
uninstall First, confirm whether it has been inst...
The simplest application of store in Vue is globa...
Table of contents 1. Regular expression creation ...
Table of contents 1.Linux login interface 2. Writ...
Three tables are connected. Field a of table A co...
Table of contents 1. Official Documentation 2. Cr...