Today, to achieve a scheduled task automatically generate static page function, need to use the terminal to set the scheduled task.

The command crontab -e should be typed on the terminal to edit crontab.

But I tried to edit it many timescrontabAll are successful. Each save fails.

Went to the Internet for a long time, found that the Linux system is related to the problem, no Mac, in line with Linux and Mac one milk compatriots, try to use Linux method to solve, but he is not as imagined, not according to the common sense, there is no Linux editor options (more common is the need to choose the editor).

-u root = -u root = -u root = -u root = -u root = -u root

Helpless, had to continue to turn over the forum, finally found a method, can directly output to the specified file, do not have to edit the file.

Echo “/ 5 * * * * PHP/Users/zyj NetBeansProjects cms_admin/cron. PHP home index crontab_build_html > / dev/null” | crontab -u root

I thought it would work, but it didn’t work out…



And he will-u rootDelete. This is a success.

Due to the test needs, and will be five minutes set to one minute, found really good, very clever ah ~ ~ ~ the first time to play so, there are small excitement!



Because it’s set to one minute, so the first two timeslsThere is no particular change, and on the third execution, because exactly one minute has passed, there is a change, executes the specified file, generates one, okayindex.htmlStatic file, well, that’s it, good good ~ ~ ~