I'm running a search service on my development computer, and I have to run an indexer (.exe file) and restart a service every 1-5 minutes (I'm using sphinx search). How would I go about doing this in Windows? My thought is to run a batch file through windows task scheduler, but what do you do?
adamcroft
问问题
349 次
2 回答
1
Use Windows Task Scheduler
while in Windows. Use cron
while in Linux.
Otherwise, you could write a daemon process which would sleep in an infinite loop for a specified interval and re-index once the interval is over. Then again, it would sleep and continue the process.
For example (in Perl):
#!perl
use strict;
use warnings;
use Proc::Daemon;
Proc::Daemon::Init;
my $minutes = 5;
my $seconds = 60 * $minutes;
while (1) {
sleep($seconds);
# Do necessary work
}
于 2009-07-05T09:14:22.570 回答
1
我发现 pycron 作为内置任务调度程序的替代品非常有用。如果你习惯了 unix cron 风格,你会从一开始就爱上它。它有一个可编辑的配置文件和日志文件以及更多选项。
一篇关于它的文章:http: //www.bigbluehost.com/article4.html
于 2009-07-05T15:42:45.610 回答