CentOS timed reboot Nginx to resolve LNMP 502 Bad Gateway

Source: Internet
Author: User
Tags centos

command format is as follows:

* * * * command

Time-sharing and Lunar Week command

The 1th column represents minutes 1~59 per minute with * or */1

The 2nd column represents the hour 1~23 (0 for 0 points)

The 3rd column represents the date 1~31

The 4th column represents the month 1~12

The 5th list of the week 0~6 (0 for Sunday)

6th column the command to run


The specific modification method is as follows:

Use the SSH login server and enter the CRONTAB-E command to enter the Cron Scheduled Task table by clicking Enter.

Under the # m H Dom Mon Dow command, add one line:

*/1 * * * * */ROOT/LNMP restart//reboot once every 1 hours;

or 0 0 * * * * */ROOT/LNMP Restart//0-point reboot per day.

If you are using CentOS, then enter the CRONTAB-E command may be a blank document, so that only the key to the keyboard I enter the editing mode, and then the above you need to enter the command, and then click Esc to exit the edit state, and then enter: Wq return to save.

To confirm success, you can use the Crontab-l command to view the list of scheduled tasks.

Some examples of crontab files:

* * * */etc/init.d/nginx restart

21:30 restart Nginx per night.

4 1,10,22 * */etc/init.d/nginx restart

1, 10, 22nd of 4:45 restart Nginx per month.

1 * * 6,0/etc/init.d/nginx restart

Every Saturday, Sunday of 1:10 restart Nginx.

0,30 18-23 * * * */etc/init.d/nginx restart

Restart Nginx every 30 minutes from 18:00 to 23:00 every day.

0 * * 6/etc/init.d/nginx restart

11:00 PM restarts Nginx every Saturday.

* */1 * * * */etc/init.d/nginx restart

Restart Nginx every hour.

* 23-7/1 * * * */etc/init.d/nginx restart

Between 11 o'clock and 7 in the morning, restart nginx every hour.

0 4 * Mon-wed/etc/init.d/nginx restart

4th per month with 11 points per Monday to Wednesday restart Nginx

0 4 1/etc/init.d/nginx * Restart

Restart Nginx at 4 o ' January 1.

*/30 * * * */usr/sbin/ntpdate 210.72.145.20

Sync time every half hour

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.