sebastianfeldmann / phpbu

PHP Backup Utility - Creates and encrypts database and file backups, syncs your backups to other servers or cloud services and assists you monitor your backup process
https://phpbu.de
Other
1.29k stars 110 forks source link

exit-code: 137 message: /usr/bin/tar #348

Open beegegroup opened 1 year ago

beegegroup commented 1 year ago

Hi Sebastian,

We are using your Tool to Backup our client-Websites successfully. We are happy with the Way it Backups our files.

We are now migrating one of our big Websites to a different Server. Which hasn't a Backup tool to upload to a remote File-Server.

The Website has at least 120GB of Data.

So during the Cron-Job we get following Message per Mail: Exception 'RuntimeException' with message 'Command failed: exit-code: 137 message: /usr/bin/tar: Removing leading..' from member names /usr/bin/tar: Removing leading ../' from member names /usr/bin/tar: -: Wrote only 2048 of 10240 bytes /usr/bin/tar: Error is not recoverable: exiting now Killed ' in phar:///usr/www/users/janitp/01backup/phpbu.phar/lib/sf-cli/Command/Runner/Simple.php:61

Could you help us out with that?

Also, is there a possibility to Backup Data that we access through a symlink? Or is it possible to use a Full-Path as a Target to Backup?

Kind regards

Stefan

sebastianfeldmann commented 1 year ago

Hi Stefan,

exit code: 137 means the process is killed because it ran out of memory.

Not sure if tar or PHP ran out of memory.

Are you packing a lot of small files together or only a couple of huge files? If it's a lot of small files the CLI output buffer calling the tar from phpbu could be the issue.

Regarding the symlink / absolute path question: As long as tar can access the files with the given path from the CWD everything should work fine.

beegegroup commented 1 year ago

Hi Sebastian,

not quite sure, but the project does contain alot of files.

According to find [folder] -type f | wc -l there are 1293013 files.

The folder which has the phpbu.phar is a htaccess-file (recommended by the hoster) which sets the PHP-Memory limit and execution_time... don't know if the settings are working.

Not quite sure, what you mean by output-buffer^^

sebastianfeldmann commented 1 year ago

If you are executing phpbu on the CLI the htaccess settings are not working. But it looks like it's not phpbu running out of memory it looks like the tar command is because of its exit code of 137.

If you run phpbu --debug --simulate it should just output the commands it will run in a real backup. You can try to execute the tar command from the debug output manually just to make sure it works.

beegegroup commented 1 year ago

I used following Command (updated) :

"/usr/bin/tar" --exclude='01backup' --listed-incremental='/usr/www/users/janitp/01backup/metadata.snar' -c -C '/usr/www/users/janitp/01backup' '..' | "pv" -qL '5m' > /usr/www/users/janitp/01backup/data/data-20230912-1409.tar &

unfortunately I wasn't able to run the command per ssh...

could you assist?

I also tried:

screen
/usr/bin/tar" --exclude='01backup' --listed-incremental='/usr/www/users/janitp/01backup/metadata.snar' -c -C '/usr/www/users/janitp/01backup' '..' | "pv" -qL '5m' > /usr/www/users/janitp/01backup/data/data-20230912-1409.tar >> backup-log.txt &

alt +a +d

beegegroup commented 12 months ago

Hey Sebastian,

i checked ssh today, and i got following info: janitp:~$ "/usr/bin/tar" --exclude='01backup' --listed-incremental='/usr/www/users/janitp/01backup/metadata.snar' -c -C '/usr/www/users/janitp/01backup' '..' | "pv" -qL '5m' > /usr/www/users/janitp/01backup/data/data-20230912-1409.tar >> backup-log.txt & [4] 25164 janitp:~$ ps aux | grep tar janitp 35501 0.0 0.0 7800 652 pts/1 S+ 09:13 0:00 grep tar [1] Killed "/usr/bin/tar" --exclude='01backup' --listed-incremental='/usr/www/users/janitp/01backup/metadata.snar' -c -C '/usr/www/users/janitp/01backup' '..' | "pv" -qL '5m' > /usr/www/users/janitp/01backup/data/data-20230912-1409.tar [2] Killed "/usr/bin/tar" --exclude='01backup' --listed-incremental='/usr/www/users/janitp/01backup/metadata.snar' -c -C '/usr/www/users/janitp/01backup' '..' | "pv" -qL '5m' > /usr/www/users/janitp/01backup/data/data-20230912-1409.tar [3] Killed "/usr/bin/tar" --exclude='01backup' --listed-incremental='/usr/www/users/janitp/01backup/metadata.snar' -c -C '/usr/www/users/janitp/01backup' '..' | "pv" -qL '5m' > /usr/www/users/janitp/01backup/data/data-20230912-1409.tar >> backup-log.txt [4]+ Killed "/usr/bin/tar" --exclude='01backup' --listed-incremental='/usr/www/users/janitp/01backup/metadata.snar' -c -C '/usr/www/users/janitp/01backup' '..' | "pv" -qL '5m' > /usr/www/users/janitp/01backup/data/data-20230912-1409.tar >> backup-log.txt

I saw the killed response before. So maybe with the Server-Settings certain processes get automatically killed.

kind regards

Stefan