aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-05-02 19:08:05 -0300
committermarcelloc <marcellocoutinho@gmail.com>2012-05-02 19:08:05 -0300
commit5f2c48fd8487d5fd1d8cd6445007900e3d4042df (patch)
tree61dfcb54927addaee6d607be15c0dc178c6b7086
parentb18a68f5add6ca6af5fb2f96732adf264e6c09f4 (diff)
downloadpfsense-packages-5f2c48fd8487d5fd1d8cd6445007900e3d4042df.tar.gz
pfsense-packages-5f2c48fd8487d5fd1d8cd6445007900e3d4042df.tar.bz2
pfsense-packages-5f2c48fd8487d5fd1d8cd6445007900e3d4042df.zip
squid3 - reduce squid startup time and include boot process check
-rwxr-xr-xconfig/dansguardian/dansguardian.inc8
-rw-r--r--config/squid-reverse/squid.inc50
2 files changed, 38 insertions, 20 deletions
diff --git a/config/dansguardian/dansguardian.inc b/config/dansguardian/dansguardian.inc
index 72623b4f..56acfc5e 100755
--- a/config/dansguardian/dansguardian.inc
+++ b/config/dansguardian/dansguardian.inc
@@ -87,6 +87,8 @@ function sync_package_dansguardian() {
# detect boot process
if (is_array($_POST)){
if (preg_match("/\w+/",$_POST['__csrf_magic']))
+ unset($boot_process);
+ else
$boot_process="on";
}
@@ -1011,7 +1013,7 @@ EOF;
}
file_put_contents($script, $new_clamav_startup, LOCK_EX);
chmod ($script,0755);
- if (file_exists('/var/run/dansguardian.pid') && is_process_running('clamd') && $botting){
+ if (file_exists('/var/run/dansguardian.pid') && is_process_running('clamd') && !isset($boot_process)){
log_error('Stopping clamav-clamd');
mwexec("$script stop");
}
@@ -1033,7 +1035,7 @@ EOF;
chmod ($script,0755);
if (is_process_running('dansguardian')){
#prevent multiple reloads during boot process
- if ($botting){
+ if (!isset($boot_process)){
log_error('Reloading Dansguardian');
exec("/usr/local/sbin/dansguardian -r");
}
@@ -1062,7 +1064,7 @@ EOF;
conf_mount_ro();
#avoid sync during boot process
- if ($botting){
+ if (!isset($boot_process)){
$synconchanges = $config['installedpackages']['dansguardiansync']['config'][0]['synconchanges'];
if(!$synconchanges && !$syncondbchanges)
return;
diff --git a/config/squid-reverse/squid.inc b/config/squid-reverse/squid.inc
index 16bf4bbb..073468e5 100644
--- a/config/squid-reverse/squid.inc
+++ b/config/squid-reverse/squid.inc
@@ -1331,6 +1331,15 @@ function squid_resync_msnt() {
function squid_resync() {
global $config;
+
+ # detect boot process
+ if (is_array($_POST)){
+ if (preg_match("/\w+/",$_POST['__csrf_magic']))
+ unset($boot_process);
+ else
+ $boot_process="on";
+ }
+
conf_mount_rw();
foreach (array( SQUID_CONFBASE,
SQUID_ACLDIR,
@@ -1342,24 +1351,27 @@ function squid_resync() {
chgrp($dir, 'proxy');
squid_chown_recursive($dir, 'proxy', 'proxy');
}
- $conf = squid_resync_general() . "\n";
- $conf .= squid_resync_cache() . "\n";
- $conf .= squid_resync_redirector() . "\n";
- $conf .= squid_resync_upstream() . "\n";
- $conf .= squid_resync_nac() . "\n";
- $conf .= squid_resync_traffic() . "\n";
- $conf .= squid_resync_reverse() . "\n";
- $conf .= squid_resync_auth();
- squid_resync_users();
- squid_write_rcfile();
- squid_sync_on_changes();
-
+ if (!isset($boot_process)){
+ $conf = squid_resync_general() . "\n";
+ $conf .= squid_resync_cache() . "\n";
+ $conf .= squid_resync_redirector() . "\n";
+ $conf .= squid_resync_upstream() . "\n";
+ $conf .= squid_resync_nac() . "\n";
+ $conf .= squid_resync_traffic() . "\n";
+ $conf .= squid_resync_reverse() . "\n";
+ $conf .= squid_resync_auth();
+ squid_resync_users();
+ squid_write_rcfile();
+ squid_sync_on_changes();
+
+ #write config file
+ file_put_contents(SQUID_CONFBASE . '/squid.conf', $conf);
+ }
+
/* make sure pinger is executable */
if(file_exists("/usr/local/libexec/squid/pinger"))
exec("chmod a+x /usr/local/libexec/squid/pinger");
- file_put_contents(SQUID_CONFBASE . '/squid.conf', $conf);
-
$log_dir = $config['installedpackages']['squid']['config'][0]['log_dir'].'/';
if(!is_dir($log_dir)) {
@@ -1370,12 +1382,16 @@ function squid_resync() {
squid_dash_z();
+
if (!is_service_running('squid')) {
log_error("Starting Squid");
mwexec("/usr/local/sbin/squid");
- } else {
- log_error("Reloading Squid for configuration sync");
- mwexec("/usr/local/sbin/squid -k reconfigure");
+ }
+ else {
+ if (!isset($boot_process)){
+ log_error("Reloading Squid for configuration sync");
+ mwexec("/usr/local/sbin/squid -k reconfigure");
+ }
}
// Sleep for a couple seconds to give squid a chance to fire up fully.