检查cronjob
function cronjob_exists($command){
    $cronjob_exists=false;
    exec('crontab -l', $crontab);
    if(isset($crontab)&&is_array($crontab)){
        $crontab = array_flip($crontab);
        if(isset($crontab[$command])){
            $cronjob_exists=true;
        }
    }
    return $cronjob_exists;
}
追加cronjob
function append_cronjob($command){
    if(is_string($command)&&!empty($command)&&cronjob_exists($command)===FALSE){
        //add job to crontab
        exec('echo -e "`crontab -l`\n'.$command.'" | crontab -', $output);
    }
    return $output;
}
删除crontab
exec('crontab -r', $crontab);
例
exec('crontab -r', $crontab);
append_cronjob('* * * * * curl -s http://localhost/cron/test1.php');
append_cronjob('* * * * * curl -s http://localhost/cron/test2.php');
append_cronjob('* * * * * curl -s http://localhost/cron/test3.php');