phpbu icon indicating copy to clipboard operation
phpbu copied to clipboard

zip Compression

Open rohan-nitsan opened this issue 2 years ago • 2 comments

I used the zip compression technique.

But the compressed file was saved with only .tar. It's working fine with gzip and bzip2 compression.

I also get an error in the generated log

"errors": [
        {
            "class": "RuntimeException",
            "message": "Command failed:\n  exit-code: 3\n  message:   \n",
            "file": "phar:\/\/\/var\/www\/html\/typo3conf\/ext\/ns_backup\/phpbu.phar\/lib\/sf-cli\/Command\/Runner\/Simple.php",
            "line": 57
        }
    ],

Here is my configuration json

{
  "verbose": true,
  "debug": false,
  "logging": [
    {
      "type": "json",
      "target": "/var/www/html/rohan/uploads/tx_nsbackup/json/test_fileadmin_log.json"
    },
    {
      "type": "mail",
      "options": {
        "transport": "mail",
        "recipients": "[email protected]",
        "subject": "[fileadmin] Test - NS Backup Email",
        "sendOnlyOnError": "0"
      }
    }
  ],
  "backups": [
    {
      "name": "27112023_1333_Test",
      "source": {
        "type": "tar",
        "options": {
          "path": "/var/www/html/fileadmin"
        }
      },
      "target": {
        "dirname": "/var/www/html/rohan/uploads/tx_nsbackup/fileadmin",
        "filename": "fileadmin-%Y%m%d-%H%i.tar",
        "compress": "zip"
      },
      "cleanup": {
        "type": "quantity",
        "options": {
          "amount": "2"
        }
      }
    }
  ]
}

Generated json log

{
    "status": 1,
    "timestamp": 1701092018,
    "duration": 0.0447,
    "backupCount": 1,
    "backupFailed": 1,
    "errorCount": 1,
    "errors": [
        {
            "class": "RuntimeException",
            "message": "Command failed:\n  exit-code: 3\n  message:   \n",
            "file": "phar:\/\/\/var\/www\/html\/typo3conf\/ext\/ns_backup\/phpbu.phar\/lib\/sf-cli\/Command\/Runner\/Simple.php",
            "line": 57
        }
    ],
    "backups": [
        {
            "name": "27112023_1333_Test",
            "status": 1,
            "checks": {
                "executed": 0,
                "failed": 0
            },
            "crypt": {
                "executed": 0,
                "skipped": 0,
                "failed": 0
            },
            "syncs": {
                "executed": 0,
                "skipped": 0,
                "failed": 0
            },
            "cleanup": {
                "executed": 0,
                "skipped": 0,
                "failed": 0
            }
        }
    ],
    "debug": [
        "\/usr\/sbin\/tar -cf '\/var\/www\/html\/rohan\/uploads\/tx_nsbackup\/fileadmin\/fileadmin-20231127-1333.tar' -C '\/var\/www\/html' 'fileadmin'",
        "exception: Command failed:\n  exit-code: 3\n  message:   \n"
    ]
}

rohan-nitsan avatar Nov 27 '23 13:11 rohan-nitsan

Exit code 3 happens when a file is changed during the backup process. You can add the ignoreFailedRead option to your config and set it to true. This is of course risky and you should check your backups regularly :)

The zip issue is, that depending on your OS zip is not available. phpbu will always create tars so your backup becomes a single file to move around. Especially if your backup source is a directory.

sebastianfeldmann avatar Nov 27 '23 19:11 sebastianfeldmann

Hi @sebastianfeldmann,

Thanks for your answer. I tried the ignoreFailedRead configuration, but still i got the same error.

Here is my json configration

"source": {
    "type": "tar",
    "options": {
        "ignoreFailedRead": true,
        "path": "/var/www/html/fileadmin"
    }
}

rohan-nitsan avatar Dec 04 '23 05:12 rohan-nitsan