aboutsummaryrefslogtreecommitdiffstats
path: root/config/squidGuard-devel
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-09-05 14:16:41 +0200
committerdoktornotor <notordoktor@gmail.com>2015-09-05 14:16:41 +0200
commit44179f72dae6d2a47592314db9cdf29b380cb152 (patch)
tree71e5140d6dfadc8a01e42fef9c94c967eea2a11f /config/squidGuard-devel
parent46d4da44f8da4cca4eee0e91382c8d2157d8afb1 (diff)
downloadpfsense-packages-44179f72dae6d2a47592314db9cdf29b380cb152.tar.gz
pfsense-packages-44179f72dae6d2a47592314db9cdf29b380cb152.tar.bz2
pfsense-packages-44179f72dae6d2a47592314db9cdf29b380cb152.zip
squidGuard-devel - install_cron_job() instead of reimplementing it
Diffstat (limited to 'config/squidGuard-devel')
-rw-r--r--config/squidGuard-devel/squidguard_configurator.inc62
1 files changed, 4 insertions, 58 deletions
diff --git a/config/squidGuard-devel/squidguard_configurator.inc b/config/squidGuard-devel/squidguard_configurator.inc
index ff2b9f2c..8fdae6ce 100644
--- a/config/squidGuard-devel/squidguard_configurator.inc
+++ b/config/squidGuard-devel/squidguard_configurator.inc
@@ -1958,65 +1958,11 @@ function squidguard_cron_install()
global $squidguard_config;
$on_off = $squidguard_config[F_LOGROTATION] == 'on';
-
- $opt = "";
+ $cron_cmd = "/usr/bin/nice -n20 " . SQUIDGUARD_SCR_LOGROTATE;
if ($on_off) {
- $opt = array("0", "0", "*", "*", "*", "root", "/usr/bin/nice -n20 " . SQUIDGUARD_SCR_LOGROTATE);
- }
- squidguard_setup_cron("squidGuard_logrotate", $opt, $on_off);
-}
-
-# ------------------------------------------------------------------------------
-# squidguard_setup_cron
-# ------------------------------------------------------------------------------
-# $options: [0]='minute', [1]='hour', [2]='mday', [3]='month', [4]='wday', [5]='who', [6]='command'
-# ------------------------------------------------------------------------------
-function squidguard_setup_cron($task_key, $options, $on_off)
-{
- global $config;
- $cron_item = array();
-
- # $on_off = TRUE/FALSE - install/deinstall cron task:
- # prepare new cron item
- if (is_array($options)) {
- $cron_item['minute'] = $options[0];
- $cron_item['hour'] = $options[1];
- $cron_item['mday'] = $options[2];
- $cron_item['month'] = $options[3];
- $cron_item['wday'] = $options[4];
- $cron_item['who'] = ($options[5]) ? $options[5] : 'nobody';
- $cron_item['command'] = $options[6];
- }
-
- # unset old cron task with $task_key
- if (!empty($task_key)) {
- $flag_cron_upd = false;
- # delete old cron task if exists
- if (is_array($config['cron']['item'])) {
- foreach($config['cron']['item'] as $key => $val) {
- if (strpos($config['cron']['item'][$key]['command'], $task_key) !== false) {
- unset($config['cron']['item'][$key]);
- $flag_cron_upd = true;
- break;
- }
- }
- }
-
- # set new cron task
- if (($on_off === true) and !empty($cron_item)) {
- $config['cron']['item'][] = $cron_item;
- $flag_cron_upd = true;
- }
-
- # write config and configure cron only if cron task modified
- if ($flag_cron_upd === true) {
- write_config("Installed cron task '$task_key' for 'squidGuard' package");
- configure_cron();
- }
- }
- else {
- # ! error $name !
- return;
+ install_cron_job("{$cron_cmd}", true, "0", "0", "*", "*", "*", "root");
+ } else {
+ install_cron_job("{$cron_cmd}", false);
}
}