Part-DB-server icon indicating copy to clipboard operation
Part-DB-server copied to clipboard

Adjustments to ease scripted 'automatic' backup

Open eren-rudy opened this issue 1 month ago • 1 comments

Is your feature request related to a problem? Please describe. I am trying to set up "automatic"/"part-db supported" (as per instructions here) using cron to make them automatically recurring, but I am running into one of 2 problems:

  1. Running sudo -u www-data php bin/console partdb:backup gives me the following permission issue: Image

I am able to create files and directories as www-data to my backup directory, so maybe the parent process that is making this fopen() call isn't running as www-data? I've granted rwx permissions for the backup directory to user/group/other. Maybe this could be considered a bug by itself? Or quite possibly it could be user error as I am not an export on this stuff.

  1. Trying to workaround this by running as root: sudo php bin/console partdb:backup gives me the dialog asking me to confirm that I want to continue given the risk of causing permission problems. I don't really want to have to deal with automating a script that has to parse the output of the backup program... I tried running with the --no-interaction flag, but it just causes the backup to abort.

Describe the solution you'd like It would be nice if there was an easy way to schedule recurring automatic (Part DB supported) backups.

Describe alternatives you've considered Writing, this it looks like I can probably do what I need by automating the 'manual' backup process, so apologies if this is superfluous. I thought I might post anyways in case it's desired to simplify this somehow, or there is some obvious workaround I am missing.

eren-rudy avatar Nov 28 '25 18:11 eren-rudy

By default the user www-data can not write anywhere but in /var/www/.

You could create the backup somewhere in there, then move it where you want it using your user account. Example cronjob: sudo -u www-data php bin/console partdb:backup --full /var/www/partdb/backup.zip && mv /var/www/partdb/backup.zip ~/partdb_$(date -I).zip

d-buchmann avatar Dec 03 '25 14:12 d-buchmann