Simplify backup scripts?

Backup script often have this:

# Backup the NGINX configuration
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"

# Backup the systemd service unit
ynh_backup "/etc/systemd/system/$app.service"

# Backup the logrotate configuration
ynh_backup "/etc/logrotate.d/$app"

The restore scripts often recreates these files like:

ynh_config_add_nginx
ynh_config_add_systemd
ynh_config_add_logrotate "$log_file"

So it’s nice for completeness if the backup contains the files, but makes problems, if the file path will be changes in some way (e.g.: domain changes or the create script just changes something)

So i think it’s potential for more robustness:

A) just don’t backup files, that will be recreated on restore

B) backup the files with a helper that build the path

Having the full backup can help in debugging. Like if you made some custom change in the nginx config or the service but forgot about it… At upgrade, these changes are likely to be overwritten, and things will work differently. But you will still be able to check in the backup to remember and adapt.

Haven’t tested/investigated that, but I guess you could just make it run the change_url script and that should fix such issue, and maybe it is even done by default.

Not sure to understand what you mean by “create script” ?