* Thu Sep 04 2025 Brian Read <brianr@koozali.org> 11.1-6.sme
- Add favicon to mailstats table, summary and detailed pages [SME: 13121] - Bring DB config reading for mailstats itself inline with php summary and detailed logs - using /etc/mailstats/db.php [SME: 13121] - Remove DB config fields from the SM2 config panel {sme: 13121] - Arrange for password to be generated and mailstats user to be set with limited permissions [SME: 13121]
This commit is contained in:
@@ -111,7 +111,7 @@ except ImportError:
|
||||
logging.warning("Matplotlib is not installed - no graphs")
|
||||
enable_graphs = False;
|
||||
|
||||
Mailstats_version = '1.2'
|
||||
Mailstats_version = '1.3'
|
||||
build_date_time = "2024-06-18 12:03:40OURCE"
|
||||
build_date_time = build_date_time[:19] #Take out crap that sneaks in.
|
||||
|
||||
@@ -123,7 +123,6 @@ data_file_path = script_dir+'/../..' #back to the top
|
||||
now = datetime.now()
|
||||
yesterday = now - timedelta(days=1)
|
||||
formatted_yesterday = yesterday.strftime("%Y-%m-%d")
|
||||
#html_page_path = data_file_path+"/home/e-smith/files/ibays/mesdb/html/mailstats/"
|
||||
html_page_dir = data_file_path+"/opt/mailstats/html/"
|
||||
template_dir = data_file_path+"/opt/mailstats/templates/"
|
||||
logs_dir = data_file_path+"/opt/mailstats/logs/"
|
||||
@@ -1374,7 +1373,7 @@ if __name__ == "__main__":
|
||||
count_records_to_db = 0;
|
||||
|
||||
# Db save control
|
||||
saveData = get_value(ConfigDB,"mailstats","SaveDataToMySQL","no") == 'yes' or forceDbSave
|
||||
saveData = get_value(ConfigDB,"mailstats","SaveDataToMySQL","yes") == 'yes' or forceDbSave
|
||||
logging.debug(f"Save Mailstats to DB set:{saveData} ")
|
||||
if saveData:
|
||||
# Database config retrieval
|
||||
|
15
root/usr/bin/runallmailstats.sh
Executable file
15
root/usr/bin/runallmailstats.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Extract the earliest date from the journalctl header for qpsmtpd service
|
||||
earliest_date=$(journalctl -u qpsmtpd | head -n 1 | sed -n 's/.*Logs begin at [A-Za-z]* \([0-9-]*\).*/\1/p')
|
||||
|
||||
# Get yesterday's date
|
||||
yesterday=$(date -d 'yesterday' +%F)
|
||||
|
||||
current_date="$earliest_date"
|
||||
|
||||
# Loop from earliest date to yesterday
|
||||
while [[ "$current_date" < "$yesterday" || "$current_date" == "$yesterday" ]]; do
|
||||
runmailstats.sh "$current_date"
|
||||
current_date=$(date -I -d "$current_date + 1 day")
|
||||
done
|
Reference in New Issue
Block a user