Hi Craig,
OK, so it’s a perl thing that the exit status 256 actually means 1x256. However:
> When a backup is canceled by the user, the error text is whatever was last in
> the log. It might not be a real error.
It is not canceled by the user but DumpPreShareCmd returns 1 and thus makes
BackupPC not running the backup.
Is there some way to make BackuPC display the output of the last stdout-line of
DumpPreShareCmd to show up in the host summary?
* Julian
Von: Craig Barratt via BackupPC-users
[mailto:backuppc-users@lists.sourceforge.net]
Gesendet: Freitag, 24. November 2017 22:23
An: General list for user discussion, questions and support
<backuppc-users@lists.sourceforge.net>
Cc: Craig Barratt <cbarr...@users.sourceforge.net>
Betreff: Re: [BackupPC-users] Execute bash script after each share on backup
server
But why Error 256 when it's 1? And the last Line the scripts outputs is:
Perl shifts the exit status left by 8 bits, so the reported exit status is 256
times your program's exit status.
2017-11-23 16:18:08 Output from DumpPreShareCmd: ERROR: Index ***** on ***
corrupted or locked!
I'm not sure why that output has a later timestamp (~8 minutes later) than the
exit message. I presume that's a different (later) run.
backup canceled by user (DumpPreShareCmd returned error status 0)
When a backup is canceled by the user, the error text is whatever was last in
the log. It might not be a real error.
Craig
On Thu, Nov 23, 2017 at 7:24 AM, Julian Zielke
<jzie...@next-level-integration.com<mailto:jzie...@next-level-integration.com>>
wrote:
Hi,
I've implemented some error checking in this script and it either exit with 0
(ok) or 1 (fail).
The UserCmdCheckStatus has been activated and the Logfile of BackuPPC says:
2017-11-23 16:10:30 DumpPreShareCmd returned error status 256... exiting
But why Error 256 when it's 1? And the last Line the scripts outputs is:
2017-11-23 16:18:08 Output from DumpPreShareCmd: ERROR: Index ***** on ***
corrupted or locked!
However on the host summary it says:
backup canceled by user (DumpPreShareCmd returned error status 0)
This doesn't make sense to me either, since it wasn't 0 but 1.
Anybody who can help me solving this problem?
- Julian
-----Ursprüngliche Nachricht-----
Von: Julian Zielke
Gesendet: Montag, 13. November 2017 08:55
An: 'General list for user discussion, questions and support'
<backuppc-users@lists.sourceforge.net<mailto:backuppc-users@lists.sourceforge.net>>
Betreff: AW: [BackupPC-users] Execute bash script after each share on backup
server
Ok, Fi finally fixed it.
First of all I for shure know the difference between sh and bash. I just tried
out different combinations, though my script doesn't make use of and bash-only
syntax.
However: The PATH-Variable is not available when I execute I, so I added an
export command at the beginning, resulting in my script working right.
The cleaner way would be to use absolute paths to the separate binaries, so
I'll use /usr/bin/which <bin> to invoke them properly.
Thanks anyway for your help. I'm glad the tool is so well supported by the
community, although being free and opensource.
- Julian
-----Ursprüngliche Nachricht-----
Von: Julian Zielke
Gesendet: Montag, 13. November 2017 08:34
An: General list for user discussion, questions and support
<backuppc-users@lists.sourceforge.net<mailto:backuppc-users@lists.sourceforge.net>>
Betreff: AW: [BackupPC-users] Execute bash script after each share on backup
server
Hi,
sorry for the confusion. I've tried with both arguments just for debugging
purposes.
My script used the basename-command, which isn't available during execution so
I changed that.
Now I get:
Executing DumpPostShareCmd: /bin/bash -c "/etc/BackupPC/notify.sh *arg1* *arg2*"
server01: -c: line 0: unexpected EOF while looking for matching `"'
server01: -c: line 1: syntax error: unexpected end of file
The command is:
/bin/bash -c "/etc/BackupPC/notify.sh $host $share $type $xferOK"
So what's unexpected here? I have to quote the scrit arguments, otherwise bash
doesn't recognize them.
- Julian
-----Ursprüngliche Nachricht-----
Von: Holger Parplies [mailto:wb...@parplies.de<mailto:wb...@parplies.de>]
Gesendet: Freitag, 10. November 2017 19:46
An: General list for user discussion, questions and support
<backuppc-users@lists.sourceforge.net<mailto:backuppc-users@lists.sourceforge.net>>
Betreff: Re: [BackupPC-users] Execute bash script after each share on backup
server
Hi,
Les Mikesell wrote on 2017-11-10 11:13:23 -0600 [Re: [BackupPC-users] Execute
bash script after each share on backup server]:
> On Fri, Nov 10, 2017 at 10:11 AM, Julian Zielke
> <jzie...@next-level-integration.com<mailto:jzie...@next-level-integration.com>>
> wrote:
> > I???ve written a script which should be run after each processed
> > share of a host.
> >
> > So I???ve tried using:
> > /bin/bash /etc/BackupPC/notify.sh -c $host -s $share -t $type -r
> > $xferOK
> >
> > The log says it is being executed but also:
> >
> > Backup failed on server01 (DumpPostUserCmd returned error status
> > 256)
> >
> > When I run the script using sh -c ????????? backuppc iot runs fine.
> >
> > So what???s my mistake here?
>
> Your script needs to return an exit code of 0. [...] you can add a
> line 'exit 0' at the end to make backuppc consider it successful regardless.
that was my first thought, too, but there is a bit of confusion in the question.
1. You are talking about running a script after each processed *share*, but
the error message complains about DumpPostUserCmd, not DumpPostShareCmd.
The remark about 'exit 0' (and all of what I'm saying) might apply to a
different script, not your notify.sh, or you are doing something slightly
different from what you are describing (or misquoting from memory).
2. You omit which BackupPC configuration variable you are setting to which
value. It appears you might be setting
$Conf{DumpPostShareCmd} = '/bin/bash /etc/BackupPC/notify.sh -c $host ...';
but then again, you might be trying the 'bash notify.sh' invocation on the
command line with the variables $host, $share, $type, $xferOK quoted here
instead of the actual values for clarity (or secrecy) (or because you are
actually using shell variables :).
In any case, I wonder why you are explicitly invoking a shell instead of
using a "#!/bin/bash" line in notify.sh. With that line (and execute
permission on notify.sh), things would be more consistent than what you
are describing above. [There might be valid reasons like noexec mounts
preventing you from doing so.]
3. You say "When I run the script using sh -c ????????? backuppc it runs fine".
First observation: 'sh' is not necessarily 'bash'. Debian made a point of
teaching the world that a while back. When you mean 'bash', you should say
'bash', and when you say 'sh', you should be sure you aren't using bashisms.
Second observation: I don't understand the 'backuppc' in there. Did you
actually mean 'su' instead of 'sh'?
4. You mention "bash notify.sh" vs. "sh -c notify.sh". Note that the semantics
of
./notify.sh
bash notify.sh
bash -c notify.sh
might be subtly different. I'd recommend selecting one version (the order
says something about my preference; yours may differ), making sure it
works, and then sticking to it.
The point being: an "error status 256", if I'm not mistaken, might as well
be a simple failure to execute the command at all. BackupPC might be
telling you "I'm about to execute the following command: ..." followed by
"It didn't work." - without being able to distinguish between "it failed
to execute" and "it executed but returned a failure". If you want to be
sure, put something like "echo `date`: here I am >> /tmp/notify.log" at
the beginning of notify.sh, supposing you don't already have a different
way of making sure it is really executed (I'm guessing you don't, because
you say that the log tells you it is being executed, not "I'm getting
the notification, so I know it is being executed").
If it's not executed, it's likely about file system permissions (of
notify.sh or of /etc/BackupPC) or perhaps selinux ...
If you need more help, you'd need to be more verbose on your BackupPC
configuration settings and log file content. Also, file permissions as noted
above and the first line of notify.sh would be interesting ...
Then again, maybe it's just the missing 'exit 0'.
Hope that helps.
Regards,
Holger
------------------------------------------------------------------------------
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<mailto: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/
Wichtiger Hinweis: Der Inhalt dieser E-Mail ist vertraulich und ausschließlich
für den bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene
Adressat dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie
bitte, dass jede Form der Kenntnisnahme, Veröffentlichung, Vervielfältigung
oder Weitergabe des Inhalts dieser E-Mail unzulässig ist. Wir bitten Sie, sich
in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen. Wir möchten
Sie außerdem darauf hinweisen, dass die Kommunikation per E-Mail über das
Internet unsicher ist, da für unberechtigte Dritte grundsätzlich die
Möglichkeit der Kenntnisnahme und Manipulation besteht
Important Note: The information contained in this e-mail is confidential. It is
intended solely for the addressee. Access to this e-mail by anyone else is
unauthorized. If you are not the intended recipient, any form of disclosure,
reproduction, distribution or any action taken or refrained from in reliance on
it, is prohibited and may be unlawful. Please notify the sender immediately. We
also would like to inform you that communication via e-mail over the internet
is insecure because third parties may have the possibility to access and
manipulate e-mails.
------------------------------------------------------------------------------
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<mailto: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/