diff options
author | jim-p <jimp@pfsense.org> | 2011-06-24 13:08:00 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-06-24 13:08:32 -0400 |
commit | eb63ff52f60d7fda2b71bf6319849604e38802e2 (patch) | |
tree | 4e32c9877c31017223d905c3f4676f93bed4d2a7 /config/squid/squid.inc | |
parent | 1c5a895c5d4bd50c6853bb6a493d8aa4c0d2337f (diff) | |
download | pfsense-packages-eb63ff52f60d7fda2b71bf6319849604e38802e2.tar.gz pfsense-packages-eb63ff52f60d7fda2b71bf6319849604e38802e2.tar.bz2 pfsense-packages-eb63ff52f60d7fda2b71bf6319849604e38802e2.zip |
Move squid's rc file write to a function, and call it from sync as well as install.
Diffstat (limited to 'config/squid/squid.inc')
-rw-r--r-- | config/squid/squid.inc | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/config/squid/squid.inc b/config/squid/squid.inc index 2aa560eb..4299abeb 100644 --- a/config/squid/squid.inc +++ b/config/squid/squid.inc @@ -208,34 +208,7 @@ function squid_install_command() { exec("/bin/chmod a+x /usr/local/libexec/squid/pinger"); if(file_exists("/usr/local/etc/rc.d/squid")) exec("/bin/rm /usr/local/etc/rc.d/squid"); - $rc = array(); - $rc['file'] = 'squid.sh'; - $rc['start'] = <<<EOD -if [ -z "`ps auxw | grep "[s]quid -D"|awk '{print $2}'`" ];then - /usr/local/sbin/squid -D -fi - -EOD; - $rc['stop'] = <<<EOD -/usr/local/sbin/squid -k shutdown -# Just to be sure... -sleep 5 -killall -9 squid 2>/dev/null -killall pinger 2>/dev/null - -EOD; - $rc['restart'] = <<<EOD -if [ -z "`ps auxw | grep "[s]quid -D"|awk '{print $2}'`" ];then - /usr/local/sbin/squid -D - else - /usr/local/sbin/squid -k reconfigure - fi - -EOD; - update_status("Writing rc.d files... One moment please..."); - conf_mount_rw(); - write_rcfile($rc); - + squid_write_rcfile(); exec("chmod a+rx /usr/local/libexec/squid/dnsserver"); foreach (array( SQUID_CONFBASE, @@ -1137,6 +1110,7 @@ function squid_resync() { $conf .= squid_resync_traffic() . "\n"; $conf .= squid_resync_auth(); squid_resync_users(); + squid_write_rcfile(); /* make sure pinger is executable */ if(file_exists("/usr/local/libexec/squid/pinger")) @@ -1440,4 +1414,32 @@ function squid_generate_rules($type) { return $rules; } +function squid_write_rcfile() { + $rc = array(); + $rc['file'] = 'squid.sh'; + $rc['start'] = <<<EOD +if [ -z "`ps auxw | grep "[s]quid -D"|awk '{print $2}'`" ];then + /usr/local/sbin/squid -D +fi + +EOD; + $rc['stop'] = <<<EOD +/usr/local/sbin/squid -k shutdown +# Just to be sure... +sleep 5 +killall -9 squid 2>/dev/null +killall pinger 2>/dev/null + +EOD; + $rc['restart'] = <<<EOD +if [ -z "`ps auxw | grep "[s]quid -D"|awk '{print $2}'`" ];then + /usr/local/sbin/squid -D + else + /usr/local/sbin/squid -k reconfigure + fi + +EOD; + conf_mount_rw(); + write_rcfile($rc); +} ?> |