Bug: Maintenance - Clear Oldest CDR not working


inside Maintenance (free) the “Clear Oldest CDR” is not working. I tried it with 1 or 10 days.
Tried cron (ever 1 minute) and i tried “Execute Now”. None worked. TOP did not show any action.

Vitalpbx: 3.1.1-3. Was not working with an older version either.


Is this a multi tenant it standard install?

Could please check if the file “/var/lib/vitalpbx/maintenance.pid” exists? if yes, then delete it.

You can try executing the script manually in debug mode. depending on your data, it might take some time.

/usr/share/vitalpbx/scripts/maintenance.php --debug
1 Like

@PitzKey: standard install. No MT.

no maintenance.pid there
/var/lib/vitalpbx/ ls addons cache dbsetup-done fax firewall_zones provisioning scripts static system_misc vitalpbx.dat


 /usr/share/vitalpbx/scripts/maintenance.php --debug

does absolut nothing.

Something is surely wrong with your installation. I’ve tested in an almost brand new installation. Check the result in the screenshot.

Maintenance Debug

Just uninstalled and reinstalled the Maintenance Add-on again: same problem.

Could you please share the maintenance Settings?


And i tried Enabled as well with Cron set to every minute.

It is required to set up a CRON and also set the option “Enabled” to “Yes.” After fulfilling the requirements execute the script again.

Maintenance Setup

As i told you before, it’s not doing anything:



I’ve tested in another server with no data.


From when is your maintenance.php?

Please uninstall addon and install it again. Then try again.

Actually, the maintenance was not installed on that server, so I have to installed before the test.

Do you have any other idea?

I just tested on a lab PBX, that has maintenance unlicensed.

[root@vitalpbx1 ~]# /usr/share/vitalpbx/scripts/maintenance.php --debug
Starting Maintenance for Tenant VitalPBX...
Setting up timezone: America/New_York
Cleaning CDR (365 days old)...
Processing Recordings...
Clean Voicemail...
Deleting Old Recording: /var/spool/asterisk/voicemail/vitalpbx-voicemail/9003/INBOX/msg0000.wav
Deleting Old Recording: /var/spool/asterisk/voicemail/vitalpbx-voicemail/104/Deleted/msg0003.wav
[root@vitalpbx1 ~]# ll /usr/share/vitalpbx/scripts/ | grep maint
-rwxr-xr-x  1 root root 13682 Sep 27 03:16 maintenance.php


However, I also don’t see a maintenance PID.

[root@vitalpbx1 ~]# ll /var/lib/vitalpbx/
total 60
drwxr-sr-x+  2 apache apache   4096 Sep 27 23:41 addons
drwxrwsr-x+ 10 apache vitalpbx 4096 Sep 27 23:41 cache
-rw-rw-r--+  1 root   vitalpbx    0 Dec  8  2020 dbsetup-done
drwxrwsr-x+  5 apache vitalpbx 4096 Sep 27 23:41 fax
drwxrwsr-x+  2 apache vitalpbx 4096 Sep 27 23:41 firewall_zones
drwxrwsr-x+  6 root   vitalpbx 4096 Jan 25  2021 provisioning
drwxrwsr-x+  2 apache vitalpbx 4096 Sep 27 23:41 scripts
drwxrwsr-x+  7 apache vitalpbx 4096 Sep 27 23:41 static
drwxrwsr-x+  2 root   vitalpbx 4096 Dec  8  2020 system_misc
-rw-rw-r--+  1 apache vitalpbx  618 Dec  8  2020 vitalpbx.dat

The maintenance PID is deleted once the process is finished. This file is to avoid the server generating multiple processes with the same script. However, this file could remain for some reason avoiding the script run again.