php定时执行sphinx的增量索引

/**
     * 每天定时执行的sphinx索引增量更新
     * @author guo.jing
     * 2015-05-08
     * @param $indexerArr(执行要更新的索引)
     */
    public function updateCoreseekIndexer($indexerArr = array()) {
        if ($indexerArr) {
            foreach ($indexerArr as $indexerName) {
                shell_exec('sudo -S sh ' . CORESEEK_SH_DIR."coreseek_rebuild.sh " . $indexerName.' 2> /tmp/error.txt');
            }
        }
    }

sh文件内容:

#!/bin/sh

#/usr/local/coreseek/bin/searchd -c /etc/csft.conf --stop

/usr/local/coreseek/bin/indexer -c /etc/csft.conf $1 --rotate