From 79bc50c74f9ddad03cd66f897bc18796f00b0006 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 14 Nov 2008 10:10:45 -0500
Subject: [PATCH] Fixed bug #265 cronjob creates emails on some systems.

---
 install/lib/installer_base.lib.php |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index c5a689f..dbafbda 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -895,9 +895,14 @@
 		exec('crontab -u root -l > crontab.txt');
 		$existing_root_cron_jobs = file('crontab.txt');
 		
+		// 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]);
+		}
+		
 		$root_cron_jobs = array(
-			'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
-			'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
+			'* * * * * /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)) {
@@ -913,7 +918,13 @@
 		exec('crontab -u getmail -l > crontab.txt');
 		$existing_cron_jobs = file('crontab.txt');
 		
-		$cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf &> /dev/null');
+		$cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf > /dev/null');
+		
+		// remove existing ispconfig cronjobs, in case the syntax has changed
+		foreach($cron_jobs as $key => $val) {
+			if(stristr($val,$cf['program'])) unset($cron_jobs[$key]);
+		}
+		
 		foreach($cron_jobs as $cron_job) {
 			if(!in_array($cron_job."\n", $existing_cron_jobs)) {
 				$existing_cron_jobs[] = $cron_job."\n";

--
Gitblit v1.9.1