diff options
author | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-05-29 18:14:31 -0300 |
---|---|---|
committer | marcelloc <marcellocoutinho@gmail.com> | 2012-05-29 18:14:31 -0300 |
commit | 39261877116dd9992afa830f334550f115f1a8a9 (patch) | |
tree | f5a206371552139f7f950bf89662cefb2c80d3bd /config/squid-reverse/squid.inc | |
parent | 20242bdf3c8cee36ab4d49a0d63f824f4b2f8f70 (diff) | |
download | pfsense-packages-39261877116dd9992afa830f334550f115f1a8a9.tar.gz pfsense-packages-39261877116dd9992afa830f334550f115f1a8a9.tar.bz2 pfsense-packages-39261877116dd9992afa830f334550f115f1a8a9.zip |
squid3 - start squid only if xml config exists
Diffstat (limited to 'config/squid-reverse/squid.inc')
-rw-r--r-- | config/squid-reverse/squid.inc | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/config/squid-reverse/squid.inc b/config/squid-reverse/squid.inc index 99b3cfc5..47dd7124 100644 --- a/config/squid-reverse/squid.inc +++ b/config/squid-reverse/squid.inc @@ -1375,35 +1375,37 @@ function squid_resync() { if(file_exists("/usr/local/libexec/squid/pinger")) exec("chmod a+x /usr/local/libexec/squid/pinger"); - $log_dir = $config['installedpackages']['squid']['config'][0]['log_dir'].'/'; - - if(!is_dir($log_dir)) { - log_error("Creating squid log dir $log_dir"); - make_dirs($log_dir); - squid_chown_recursive($log_dir, 'proxy', 'proxy'); - } - - squid_dash_z(); - + if (is_array($config['installedpackages']['squid']['config'][0])){ + $log_dir = $config['installedpackages']['squid']['config'][0]['log_dir'].'/'; - if (!is_service_running('squid')) { - log_error("Starting Squid"); - mwexec("/usr/local/sbin/squid"); - } - 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. - for ($i=0; $i < 10; $i++) { - if (!is_service_running('squid')) - sleep(1); + if(!is_dir($log_dir)) { + log_error("Creating squid log dir $log_dir"); + make_dirs($log_dir); + squid_chown_recursive($log_dir, 'proxy', 'proxy'); + } + + squid_dash_z(); + + + if (!is_service_running('squid')) { + log_error("Starting Squid"); + mwexec("/usr/local/sbin/squid"); + } + 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. + for ($i=0; $i < 10; $i++) { + if (!is_service_running('squid')) + sleep(1); + } + filter_configure(); + conf_mount_ro(); } - filter_configure(); - conf_mount_ro(); } function squid_print_javascript_auth() { |