From c47f209bfc4815e2056fa679f5083297cf292b82 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 10 Aug 2017 14:36:20 -0300 Subject: Add a protection to prevent ending up with duplicate crontab entry --- src/etc/inc/upgrade_config.inc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/etc/inc') diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index fbd6d41..34967b2 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -5364,6 +5364,15 @@ function upgrade_167_to_168() { function upgrade_168_to_169() { global $config; + $command = '/usr/bin/nice -n20 /etc/rc.update_pkg_metadata'; + if (is_array($config['cron']['item'])) { + foreach ($config['cron']['item'] as $entry) { + if ($entry['command'] == $command) { + return; + } + } + } + $config['cron']['item'][] = array( 'minute' => '1', 'hour' => '0', @@ -5371,7 +5380,7 @@ function upgrade_168_to_169() { 'month' => '*', 'wday' => '*', 'who' => 'root', - 'command' => '/usr/bin/nice -n20 /etc/rc.update_pkg_metadata' + 'command' => $command ); } -- cgit v1.1