Backup to FTP - Works only once

I’m trying to backup call recordings nightly to my Google Drive account. I found a way to do that by setting up a Filezilla FTP server on my computer and setting the Google Drive folder as the destination. To test, I set it up to save the backup to the folder “test” on my desktop. This worked the first time. It created the folder C:\Users\Brad Phillips\Desktop\test\Call_Recording_Backup and put the .tgz file in that folder. However, if I run the backup again 10 minutes later it fails. If I delete the folder Call_Recording_Backup (and the .tgz file) the backup will succeed again.

My PBX server is on the same local network as my computer with the FTP server.

Filezilla and PBX settings


filezilla settings

Logs for a successful backup
PBX

Saving Backup 6…done!
Initializing Backup 6
Backup Lock acquired!
Running pre-backup hooks…
Adding items…
Building manifest…
Creating backup…
Storing backup…
Creating directory ‘/Call_Recording_Backup’
Saving file to remote ftp
Backup file uploaded to the remote server
Running maintenance…
Whoops\Exception\ErrorException: Argument 1 passed to Touki\FTP\Model\Filesystem::setMtime() must be an instance of DateTime, boolean given, called in /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/WindowsFilesystemFactory.php on line 50 and defined in file /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Model/Filesystem.php on line 260
Stack trace:

  1. Whoops\Exception\ErrorException->() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Model/Filesystem.php:260
  2. Whoops\Run->handleError() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Model/Filesystem.php:260
  3. Touki\FTP\Model\Filesystem->setMtime() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/WindowsFilesystemFactory.php:50
  4. Touki\FTP\WindowsFilesystemFactory->build() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Manager/FTPFilesystemManager.php:82
  5. Touki\FTP\Manager\FTPFilesystemManager->findBy() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Manager/FTPFilesystemManager.php:106
  6. Touki\FTP\Manager\FTPFilesystemManager->findAll() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/FTP.php:99
  7. Touki\FTP\FTP->findFilesystems() /var/www/html/admin/modules/backup/functions.inc/class.backup.php:742
  8. FreePBX\modules\Backup\Backup->maintenance() /var/www/html/admin/modules/backup/functions.inc/class.backup.php:505
  9. FreePBX\modules\Backup\Backup->store_backup() /var/www/html/admin/modules/backup/bin/backup.php:148

Filezilla

(000024)1/4/2018 12:37:10 PM - (not logged in) (192.168.1.109)> Connected on port 64492, sending welcome message…
(000024)1/4/2018 12:37:10 PM - (not logged in) (192.168.1.109)> 220-FileZilla Server 0.9.60 beta
(000024)1/4/2018 12:37:10 PM - (not logged in) (192.168.1.109)> 220-written by Tim Kosse ([email protected])
(000024)1/4/2018 12:37:10 PM - (not logged in) (192.168.1.109)> 220 Please visit https://filezilla-project.org/
(000024)1/4/2018 12:37:10 PM - (not logged in) (192.168.1.109)> USER PBX
(000024)1/4/2018 12:37:10 PM - (not logged in) (192.168.1.109)> 331 Password required for pbx
(000024)1/4/2018 12:37:10 PM - (not logged in) (192.168.1.109)> PASS ********
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 230 Logged on
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> TYPE A
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 200 Type set to A
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> PORT 192,168,1,109,218,22
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 200 Port command successful
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> LIST /
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 150 Opening data channel for directory listing of “/”
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 226 Successfully transferred “/”
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> PORT 192,168,1,109,129,177
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 200 Port command successful
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> LIST /
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 150 Opening data channel for directory listing of “/”
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 226 Successfully transferred “/”
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> MKD /Call_Recording_Backup
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 257 “/Call_Recording_Backup” created successfully
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> TYPE I
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 200 Type set to I
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> PORT 192,168,1,109,134,33
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 200 Port command successful
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> STOR /Call_Recording_Backup/20180104-123655-1515091015-14.0.1.24-438879149.tgz
(000024)1/4/2018 12:37:10 PM - pbx (192.168.1.109)> 150 Opening data channel for file upload to server of “/Call_Recording_Backup/20180104-123655-1515091015-14.0.1.24-438879149.tgz”
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> 226 Successfully transferred “/Call_Recording_Backup/20180104-123655-1515091015-14.0.1.24-438879149.tgz”
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> TYPE A
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> 200 Type set to A
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> PORT 192,168,1,109,191,171
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> 200 Port command successful
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> LIST /Call_Recording_Backup
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> 150 Opening data channel for directory listing of “/Call_Recording_Backup”
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> 226 Successfully transferred “/Call_Recording_Backup”
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> QUIT
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> 221 Goodbye
(000024)1/4/2018 12:37:17 PM - pbx (192.168.1.109)> disconnected.

Logs for a failed backup
PBX

Saving Backup 6…Initializing Backup 6
Backup Lock acquired!
Running pre-backup hooks…
Adding items…
Building manifest…
Creating backup…
Storing backup…
Whoops\Exception\ErrorException: Argument 1 passed to Touki\FTP\Model\Filesystem::setMtime() must be an instance of DateTime, boolean given, called in /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/WindowsFilesystemFactory.php on line 50 and defined in file /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Model/Filesystem.php on line 260
Stack trace:

  1. Whoops\Exception\ErrorException->() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Model/Filesystem.php:260
  2. Whoops\Run->handleError() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Model/Filesystem.php:260
  3. Touki\FTP\Model\Filesystem->setMtime() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/WindowsFilesystemFactory.php:50
  4. Touki\FTP\WindowsFilesystemFactory->build() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Manager/FTPFilesystemManager.php:162
  5. Touki\FTP\Manager\FTPFilesystemManager->findOneBy() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Manager/FTPFilesystemManager.php:262
  6. Touki\FTP\Manager\FTPFilesystemManager->findDirectoryByName() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/Manager/FTPFilesystemManager.php:273
  7. Touki\FTP\Manager\FTPFilesystemManager->findDirectoryByDirectory() /var/www/html/admin/modules/backup/vendor/touki/ftp/lib/Touki/FTP/FTP.php:148
  8. Touki\FTP\FTP->directoryExists() /var/www/html/admin/modules/backup/functions.inc/class.backup.php:479
  9. FreePBX\modules\Backup\Backup->store_backup() /var/www/html/admin/modules/backup/bin/backup.php:148
    done!

Filezilla

(000025)1/4/2018 12:40:35 PM - (not logged in) (192.168.1.109)> Connected on port 64492, sending welcome message…
(000025)1/4/2018 12:40:35 PM - (not logged in) (192.168.1.109)> 220-FileZilla Server 0.9.60 beta
(000025)1/4/2018 12:40:35 PM - (not logged in) (192.168.1.109)> 220-written by Tim Kosse ([email protected])
(000025)1/4/2018 12:40:35 PM - (not logged in) (192.168.1.109)> 220 Please visit https://filezilla-project.org/
(000025)1/4/2018 12:40:35 PM - (not logged in) (192.168.1.109)> USER PBX
(000025)1/4/2018 12:40:35 PM - (not logged in) (192.168.1.109)> 331 Password required for pbx
(000025)1/4/2018 12:40:35 PM - (not logged in) (192.168.1.109)> PASS ********
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> 230 Logged on
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> TYPE A
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> 200 Type set to A
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> PORT 192,168,1,109,187,112
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> 200 Port command successful
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> LIST /
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> 150 Opening data channel for directory listing of “/”
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> 226 Successfully transferred “/”
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> QUIT
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> 221 Goodbye
(000025)1/4/2018 12:40:35 PM - pbx (192.168.1.109)> disconnected.

On a failed backup the first backup file is still there, but a new backup file is not added. Ideally, I’d like to backup it up each night and keep about 5 backup files in there. I have the “delete after” setting in PBX currently at “1 run” for testing.

Am I missing a setting that’s causing this issue?

nope - this looks like an outright bug. we ran into it on a number of our servers. we have not yet submitted a ticket. all of our servers are running FreePBX 13.0.192.19 and PBX Firmware:10.13.66-20

I created an issue ticket.

https://issues.freepbx.org/browse/FREEPBX-16525

thanks for the ticket info

Changing filesystem type to “auto” under the server settings fixed this for me.

When you created your backup what did you choose to narrow your backup to just call recordings? - System Audio? Full Backup? Thank you!

I’m backing up this directory

__ASTSPOOLDIR__/monitor/

This is located at /var/spool/asterisk/monitor. You can narrow it down further using dates, for example, to backup only recordings from February 20th, 2018 I could use

__ASTSPOOLDIR__/monitor/2018/02/20

My backup items in the backup just looks like this.

I wish I could set the system to only backup new recordings instead of backing up everything every time. I found a good way to make it work for me. I’m dumping the backup to a folder on my computer and having the backup delete old backups so I keep at most two backups on my computer. I’m then using a program called Allway Sync to automatically move that new backup each night to a folder on Google Drive, where I have unlimited storage. My last nightly backup is about 2.8GB, that’s for call recordings since 01/01/18.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.