Skip to content
fedora.lib.php 47.9 KiB
Newer Older
		// remove existing ispconfig cronjobs, in case the syntax has changed
		foreach($existing_root_cron_jobs as $key => $val) {
			if(stristr($val,'/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
		}
		
tbrehm's avatar
tbrehm committed
		$root_cron_jobs = array(
			'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
			'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
		);
		foreach($root_cron_jobs as $cron_job) {
			if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
				$existing_root_cron_jobs[] = $cron_job."\n";
			}
		}
		file_put_contents('crontab.txt', $existing_root_cron_jobs);
		exec('crontab -u root crontab.txt &> /dev/null');
		unlink('crontab.txt');
		
		//* Getmail crontab
		if(is_user('getmail')) {
        	$cf = $conf['getmail'];
			exec('crontab -u getmail -l > crontab.txt');
			$existing_cron_jobs = file('crontab.txt');
		
                '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /var/log/ispconfig/cron.log'
			// remove existing ispconfig cronjobs, in case the syntax has changed
tbrehm's avatar
tbrehm committed
			foreach($existing_cron_jobs as $key => $val) {
				if(stristr($val,'getmail')) unset($existing_cron_jobs[$key]);
tbrehm's avatar
tbrehm committed
			}
			foreach($cron_jobs as $cron_job) {
				if(!in_array($cron_job."\n", $existing_cron_jobs)) {
					$existing_cron_jobs[] = $cron_job."\n";
				}
			}
			file_put_contents('crontab.txt', $existing_cron_jobs);
			exec('crontab -u getmail crontab.txt &> /dev/null');
			unlink('crontab.txt');
tbrehm's avatar
tbrehm committed
		}
		
		exec('touch /var/log/ispconfig/cron.log');
tbrehm's avatar
tbrehm committed
		exec('chmod 666 /var/log/ispconfig/cron.log');