tbrehm
2008-11-17 a8a32889cc06a2c8daffc1b27167061379065046
Create getmail cronjobs only if the getmail user exists.
3 files modified
28 ■■■■■ changed files
install/dist/lib/fedora.lib.php 13 ●●●●● patch | view | raw | blame | history
install/dist/lib/opensuse.lib.php 13 ●●●●● patch | view | raw | blame | history
install/lib/installer_base.lib.php 2 ●●●●● patch | view | raw | blame | history
install/dist/lib/fedora.lib.php
@@ -690,6 +690,11 @@
        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'
@@ -704,11 +709,18 @@
        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');
        
        $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";
@@ -718,6 +730,7 @@
        exec('crontab -u getmail crontab.txt &> /dev/null');
        unlink('crontab.txt');
    }
    }
}
install/dist/lib/opensuse.lib.php
@@ -708,6 +708,11 @@
        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'
@@ -722,11 +727,18 @@
        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');
        
        $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";
@@ -736,6 +748,7 @@
        exec('crontab -u getmail crontab.txt &> /dev/null');
        unlink('crontab.txt');
    }
    }
}
install/lib/installer_base.lib.php
@@ -918,6 +918,7 @@
        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');
@@ -938,6 +939,7 @@
        exec('crontab -u getmail crontab.txt &> /dev/null');
        unlink('crontab.txt');
    }
    }
    
}