Re: [Nssbackup-team] [Question #234488]: lauching a task before backup

2013-09-18 Thread Jean-Peer Lorenz
Question #234488 on sbackup changed:
https://answers.launchpad.net/sbackup/+question/234488

Jean-Peer Lorenz proposed the following answer:
Well, the result/exit code of the scripts are checked against 0. If a script 
fails, the whole backup will fail/not start. Post-backup scripts are being run 
regardless of the 'exit' status of the backup so far. Here is the corresponding 
code snippet:
 
   def do_hook(self, hookname):
"""Runs scripts optionally defined in section 'hooks' of
configuration file. Currently defined are
* pre-backup - before preparation of backup starts
* post-backup - after completion and finishing of backup

"""
#LP #173490
import commands
hooks = None
if self.config.has_option('hooks', hookname):
hooks = str(self.config.get('hooks', hookname)).split(",")

if hooks is not None:
self.logger.info(_("Running of hooks: %s") % hookname)
for hook in hooks:
result = commands.getstatusoutput(hook)
if( 0 != result[0]):
raise exceptions.HookedScriptError(\
  "Hook %s returned error: '%s' (exit code=%s)" % (hookname,
result[1],
result[0]))


Please feel free to file an enhancement bug report which details the desired 
behaviour. Thanks.

-- 
You received this question notification because you are a member of
Simple Backup Maintainers, which is an answer contact for sbackup.

___
Mailing list: https://launchpad.net/~nssbackup-team
Post to : nssbackup-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~nssbackup-team
More help   : https://help.launchpad.net/ListHelp


Re: [Nssbackup-team] [Question #234488]: lauching a task before backup

2013-09-18 Thread Anton
Question #234488 on sbackup changed:
https://answers.launchpad.net/sbackup/+question/234488

Anton requested more information:
That's nice to know!

Does sbackup read the exit status of the pre-backup script, so the script could 
allow or block starting of the backup?
Likewise, it would be good if the post-backup script could read/know the exit 
status of sbackup.

(Ubuntu LTS - 12.04 - is providing sbackup 0.11.4)

-- 
You received this question notification because you are a member of
Simple Backup Maintainers, which is an answer contact for sbackup.

___
Mailing list: https://launchpad.net/~nssbackup-team
Post to : nssbackup-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~nssbackup-team
More help   : https://help.launchpad.net/ListHelp