From a29d0a6cf6290dc9760588ff534098f4a7a8bdac Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sat, 7 Jan 2023 23:43:08 +1100 Subject: [PATCH] permissions fix --- back/pialert.py | 17 +++++++---------- docker-compose.yml | 1 + front/settings.php | 8 +++++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/back/pialert.py b/back/pialert.py index 680d191d..12498652 100755 --- a/back/pialert.py +++ b/back/pialert.py @@ -139,11 +139,9 @@ def checkPermissionsOK(): def fixPermissions(): # Try fixing access rights if needed chmodCommands = [] - - if dbR_access == False or dbW_access == False: - chmodCommands.append(['sudo', 'chmod', 'a+rw', '-R', dbPath]) - if confR_access == False or confW_access == False: - chmodCommands.append(['sudo', 'chmod', 'a+rw', '-R', confPath]) + + chmodCommands.append(['sudo', 'chmod', 'a+rw', '-R', fullDbPath]) + chmodCommands.append(['sudo', 'chmod', 'a+rw', '-R', fullConfPath]) for com in chmodCommands: # Execute command @@ -193,9 +191,8 @@ if confR_access == False: if dbR_access == False: initialiseFile(fullDbPath, "/home/pi/pialert/back/pialert.db_bak") -if dbR_access == False or confR_access == False: - if checkPermissionsOK() == False: # second check - fixPermissions() +# last attempt +fixPermissions() #=============================================================================== # Initialise user defined values @@ -2182,8 +2179,8 @@ def send_notifications (): # DEBUG - Write output emails for testing #if True : - # write_file (logPath + '/report_output.txt', mail_text) - # write_file (logPath + '/report_output.html', mail_html) + write_file (logPath + '/report_output.txt', mail_text) + write_file (logPath + '/report_output.html', mail_html) # Send Mail if json_internet != [] or json_new_devices != [] or json_down_devices != [] or json_events != []: diff --git a/docker-compose.yml b/docker-compose.yml index 74d02ec6..c9d4e97b 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ version: "3" services: pialert: + privileged: true build: . container_name: pialert network_mode: "host" diff --git a/front/settings.php b/front/settings.php index 14cecb60..d153c977 100644 --- a/front/settings.php +++ b/front/settings.php @@ -73,7 +73,8 @@ CommitDB(); // create settings groups $isIn = ' in '; - foreach ($groups as $group) { + foreach ($groups as $group) + { $html = $html.'
@@ -84,8 +85,9 @@ CommitDB();
'; $isIn = ' '; // open the first panel only by default on page load - // populate settings for each group id="collapse100" class="panel-collapse collapse" - foreach ($settings as $set) { + // populate settings for each group + foreach ($settings as $set) + { if($set["Group"] == $group) { $html = $html.