$console .= _("Named conf files generated !"); $console .= "\n"; } // Executes the command liste bellow if (isset($_REQUEST["gen_perso_vhost"]) && $_REQUEST["gen_perso_vhost"] == 1) { perso_vhost_generate(); $console .= _("Apache vhost file for personal account generated !"); $console .= "\n"; } if (isset($_REQUEST["gen_pro_vhost"]) && $_REQUEST["gen_pro_vhost"] == 1) { pro_vhost_generate(); $console .= _("Apache vhost file generated !"); $console .= "\n"; } if (isset($_REQUEST["gen_email_account"]) && $_REQUEST["gen_email_account"] == 1) { mail_account_generate(); $console .= _("Email user and domain files generated !"); $console .= "\n"; } if (isset($_REQUEST["gen_backup_script"]) && $_REQUEST["gen_backup_script"] == 1) { backup_script_generate(); $console .= _("Backup script generated !"); $console .= "\n"; } if (isset($_REQUEST["gen_stat_script"]) && $_REQUEST["gen_stat_script"] == 1) { stat_script_generate(); $console .= _("Stat script generated !"); $console .= "\n"; } if (isset($_REQUEST["gen_fetchmail_script"]) && $_REQUEST["gen_fetchmail_script"] == 1) { fetchmail_generate();
function cronMailSystem() { global $keep_mail_generate_flag; global $conf_mta_type; global $conf_dtc_system_username; global $conf_generated_file_path; global $conf_unix_type; $cronjob_table_content = getCronFlags(); if ($cronjob_table_content["gen_qmail"] == "yes") { echo "Generating mail accounts\n"; mail_account_generate(); if ($keep_mail_generate_flag == "no") { markCronflagOk("gen_qmail='no'"); } if (file_exists($conf_generated_file_path . "/postfix_virtual_mailbox_domains")) { system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_virtual_mailbox_domains"); } if (file_exists($conf_generated_file_path . "/local_domains")) { system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/local_domains"); } if (file_exists($conf_generated_file_path . "/postfix_virtual")) { system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_virtual"); } if (file_exists($conf_generated_file_path . "/postfix_aliases")) { system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_aliases"); } if (file_exists($conf_generated_file_path . "/postfix_vmailbox")) { system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_vmailbox"); } if (file_exists($conf_generated_file_path . "/postfix_virtual_uid_mapping")) { system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_virtual_uid_mapping"); } if (file_exists($conf_generated_file_path . "/postfix_relay_domains")) { system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_relay_domains"); } if (file_exists($conf_generated_file_path . "/postfix_relay_recipients")) { system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_relay_recipients"); } } /* Didnt want it to put to seperate function, because I think its fit well in mail system's cronjob */ if ($cronjob_table_content["gen_fetchmail"] == "yes") { echo "Generating fetchmailrc"; fetchmail_generate(); } if ($cronjob_table_content["qmail_newu"] == "yes") { echo "Starting qmail-newu\n"; switch ($conf_mta_type) { case "qmail": //system("/var/qmail/bin/qmail-newu"); system("{$conf_qmail_newu_path}"); break; case "postfix": //not sure what newu equiv in postfix break; } markCronflagOk("qmail_newu='no'"); } if ($cronjob_table_content["restart_qmail"] == "yes") { switch ($conf_mta_type) { case "postfix": echo "Reloading postfix\n"; if (file_exists("/etc/init.d/postfix")) { $PATH_POSTFIX_SCRIPT = "/etc/init.d/postfix"; } else { if (file_exists("/usr/local/etc/rc.d/postfix")) { $PATH_POSTFIX_SCRIPT = "/usr/local/etc/rc.d/postfix"; } else { if (file_exists("/etc/rc.d/rc.postfix")) { $PATH_POSTFIX_SCRIPT = "/etc/rc.d/rc.postfix"; } } } if ($conf_unix_type == "gentoo" && file_exists("/etc/init.d/postfix")) { $PATH_POSTFIX_SCRIPT = "/usr/sbin/postfix"; } if ($conf_unix_type == "bsd" && file_exists("/usr/local/etc/rc.d/postfix")) { $PATH_POSTFIX_SCRIPT = "/usr/local/sbin/postfix"; } system("{$PATH_POSTFIX_SCRIPT} reload"); $PATH_POSTSUPER = "/usr/sbin/postsuper"; if (file_exists("/usr/sbin/postsuper")) { $PATH_POSTSUPER = "/usr/sbin/postsuper"; } else { if (file_exists("/usr/local/sbin/postsuper")) { $PATH_POSTSUPER = "/usr/local/sbin/postsuper"; } else { if (file_exists("/usr/bin/postsuper")) { $PATH_POSTSUPER = "/usr/bin/postsuper"; } } } // first stop queue processing in postfix echo "Stopping postfix queue...\n"; system("{$PATH_POSTSUPER} -h ALL 2>&1"); echo "Reloading amavis\n"; if (file_exists("/etc/init.d/amavis")) { system("/etc/init.d/amavis force-reload"); } else { if (file_exists("/etc/init.d/amavisd")) { // Seems a restart is best (gentoo needs it) system("/etc/init.d/amavisd restart"); // This one seems ok for slackware } else { if (file_exists("/etc/rc.d/rc.amavisd")) { system("/etc/rc.d/rc.amavisd restart"); // This is for FreeBSD } else { if (file_exists("/usr/local/etc/rc.d/amavisd")) { system("/usr/local/etc/rc.d/amavisd restart"); } } } } if (file_exists("/etc/init.d/dkimproxy")) { echo "Reloading dkfilter to reload it's domains...\n"; system("/etc/init.d/dkimproxy stop"); sleep(1); system("/etc/init.d/dkimproxy start"); } echo "Starting postfix queue...\n"; system("{$PATH_POSTSUPER} -H ALL 2>&1"); echo "Flushing the queue now, to make sure we have some mail delivery happening after amavisd restart...\n"; system("{$PATH_POSTFIX_SCRIPT} flush"); break; case "qmail": default: echo "Sending qmail-send a HUP\n"; // This runs well on stock debian woody qmail-src package. Anyone had trouble with it ? system("killall -HUP qmail-send"); break; } if ($keep_mail_generate_flag == "no") { markCronflagOk("restart_qmail='no'"); } } }