我怎么用cron?

How reload a php script every 1-5seconds in cron ? Would not it be better to use System_Daemon to reload the php script? I have Debian System.

  • You can't really do this with cron, but instead you could write a script (either shell or php) that would loop forever and do something every X seconds.

  • In addition, make a crontab entry that would run every Y minutes and launch that script (if it's still not running). You can do the latter using a pid file that your script creates (read the pid and check if there is a process with that id).

    This check can also be internal within the script - so that when the script is started more than once, it would check if another copy alrady running