Re: [BackupPC-users] Sending output of DumpPreUserCmd by email
On 05/18/17 17:30, Richard Shaw wrote: > On Thu, May 18, 2017 at 9:49 AM, Vladislav Kurz > mailto:vladislav.k...@webstep.net>> wrote: > > Hello all, > > First of all big thanks to all developers of BackupPC, it is really a > very nice and useful backup tool. > > I use DumpPreUserCmd (and similar options) to run mysqldump, or make > snapshots of filesystems before backup. I would like to have the output > of these mailed to me instead of being just logged. > > > Probably not the direction you were thinking but why not create a > systemd service file for DumpPreUserCmd to start? > > I'm assuming you're using a system which uses systemd... Hello, I have many systems, and most of them are older then systemd (so using classic init). And on those that do, I'm sometimes pulling my hair out because of systemd. But I do not want to rant about systemd here. I know I have to learn new things all my life. > If you prepend the command in the service file with a hyphen the unit > will exit cleanly even if the command failed... > > ExecStart=-/command/to/run This is not exactly what I want. I can ignore the failure by setting backuppc: UserCmdCheckStatus=0 What I want is to get any output of the script by mail. Whether it fails or not. I thought it would be more elegant if this could be done by backuppc itself than adding something like "2>&1 | mail root" to all predump scripts. -- S pozdravem Vladislav Kurz Centrála: Celní 17/5, 63900 Brno, CZ Web: http://www.webstep.net E-Mail: podp...@webstep.net Tel: 840 840 700, +420 548 214 711 Obchodní podmínky: https://zkrat.to/op -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/
Re: [BackupPC-users] Sending output of DumpPreUserCmd by email
You need DumpPreUserCmd to run to completion before continuing with the backup. Using systemd will run the command in the background (I believe even for oneshot), which is almost certainly not what you want to do. An easier solution is to write a cover script (pick you favorite scripting language - bash, python, perl etc) that runs mysqldump, emails whatever you want etc, and then point DumpPreUserCmd at your script. Craig On Thu, May 18, 2017 at 8:30 AM, Richard Shaw wrote: > On Thu, May 18, 2017 at 9:49 AM, Vladislav Kurz < > vladislav.k...@webstep.net> wrote: > >> Hello all, >> >> First of all big thanks to all developers of BackupPC, it is really a >> very nice and useful backup tool. >> >> I use DumpPreUserCmd (and similar options) to run mysqldump, or make >> snapshots of filesystems before backup. I would like to have the output >> of these mailed to me instead of being just logged. > > > Probably not the direction you were thinking but why not create a systemd > service file for DumpPreUserCmd to start? > > I'm assuming you're using a system which uses systemd... > > If you prepend the command in the service file with a hyphen the unit will > exit cleanly even if the command failed... > > ExecStart=-/command/to/run > > Then you would set your DumpPreUserCmd to "/usr/bin/systemctl start > " > > You would want to set the unit type to "oneshot" so it doesn't return > until the command is finished. > > Just a thought. > > Thanks, > Richard > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > BackupPC-users mailing list > BackupPC-users@lists.sourceforge.net > List:https://lists.sourceforge.net/lists/listinfo/backuppc-users > Wiki:http://backuppc.wiki.sourceforge.net > Project: http://backuppc.sourceforge.net/ > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/
Re: [BackupPC-users] Sending output of DumpPreUserCmd by email
On Thu, May 18, 2017 at 9:49 AM, Vladislav Kurz wrote: > Hello all, > > First of all big thanks to all developers of BackupPC, it is really a > very nice and useful backup tool. > > I use DumpPreUserCmd (and similar options) to run mysqldump, or make > snapshots of filesystems before backup. I would like to have the output > of these mailed to me instead of being just logged. Probably not the direction you were thinking but why not create a systemd service file for DumpPreUserCmd to start? I'm assuming you're using a system which uses systemd... If you prepend the command in the service file with a hyphen the unit will exit cleanly even if the command failed... ExecStart=-/command/to/run Then you would set your DumpPreUserCmd to "/usr/bin/systemctl start " You would want to set the unit type to "oneshot" so it doesn't return until the command is finished. Just a thought. Thanks, Richard -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/