I am modifying a backup script to save multiple servers with multiple services and different configurations using bash on an Ubuntu server.
I save outputs from commands into a log file and sent these by mail. If the backup got an error from any process, I want to alert user with a specific mail subject, so I need to get if all processes were good or not and to keep all logs ordered.
I searched on all over the internet and I don't get any satisfying answer so, I am now asking to you...
What is the best way to do it ?
Should I use a separate configuration for each server ? Or each service get its script file calling what it needs ? Should I use source or execute scripts ? How could I just get if an error occured with no effects on logs ?
NB : I posted originally at https://superuser.com/questions/1155495/capture-outputs-with-bash-to-log-it-and-alert-user but it seems more appropriate on Server Fault. I will remove it if you confirm.