Crontab 排程

Crontab 排程

??Crontab可不可以每秒或每三十秒排程一次, 如果不可以, 有?有其他的方法.
                                                         著   著
      
It seems cron cannot schedule jobs in seconds.
Depending on what your job is, there should be several ways to schedule jobs. For example, the following script could let you run a job for a week, and the job is scheduled to run every 30 seconds;

count=20200
while [ count -gt 0 ]
do
    run-your-job-here
    count=`$count - 1`
    sleep 30
done

This assumes that your job finish very quickly, say less than a second.

If you need some interaction with your job, you may use an "expect" script to do it for you. When I was taking a UNIX class in college, I was very impressed by what my prof. said: "Under UNIX, you can always find several ways to do the same thing." Probably that is the beauty of UNIX/Linux?:-)

good luck!