Skip to content
Snippets Groups Projects
Commit 96c95ad8 authored by Marius Cramer's avatar Marius Cramer
Browse files

- added anothier lock check for apt

- changed language import to use mb_substr
parent 02e7eaf2
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ function normalize_string($string, $quote, $allow_special = false) { ...@@ -36,7 +36,7 @@ function normalize_string($string, $quote, $allow_special = false) {
$new_string = ''; $new_string = '';
for($c = 0; $c < mb_strlen($string); $c++) { for($c = 0; $c < mb_strlen($string); $c++) {
$char = $string{$c}; $char = mb_substr($string, $c, 1);
if($in_string === true && $escaped === false && $char === $quote) { if($in_string === true && $escaped === false && $char === $quote) {
// this marks a string end (e.g. for concatenation) // this marks a string end (e.g. for concatenation)
......
...@@ -76,13 +76,13 @@ class cronjob_monitor_system_update extends cronjob { ...@@ -76,13 +76,13 @@ class cronjob_monitor_system_update extends cronjob {
/* /*
* first update the "apt database" * first update the "apt database"
*/ */
shell_exec('apt-get update'); shell_exec('while fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do sleep 2; done; apt-get update');
/* /*
* Then test the upgrade. * Then test the upgrade.
* if there is any output, then there is a needed update * if there is any output, then there is a needed update
*/ */
$aptData = shell_exec('while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do sleep 2; done; apt-get -s -qq dist-upgrade'); $aptData = shell_exec('while fuser /var/lib/dpkg/lock >/dev/null 2>&1 || fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do sleep 2; done; apt-get -s -qq dist-upgrade');
if ($aptData == '') { if ($aptData == '') {
/* There is nothing to update! */ /* There is nothing to update! */
$state = 'ok'; $state = 'ok';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment