rear/rear — pull request #503 by tbsky (2014-11-04 06:42:25+00:00)
Title: add custom script support besides PRE_RECOVERY_SCRIPT and PORT_RECOVERY_...

hi:
this is a patch for adding custom script support. this feature works like PRE_RECOVERY_SCRIPT and c, but add that ability to other stages by hooking every script at all stages. definition at config file will lookup below:

PRE_BACKUP_97_SCRIPT=(/usr/local/bin/rear-drbd_vm_backup)
POST_RESTORE_98_SCRIPT=(/usr/local/bin.rear-drbd_vm_restore)

the patch is made by suggestion/hint from schlomo:

1. working at function "Source", not "SourceStage". but I did change one line at fucntion "SourceStage". this can be prevented by add more lines at function "Source", so it is a coding choice. I found function "Source" seems only be called by "SourceStage", but maybe that is just a coincidence. please comment which coding style is preferred.

2. the format of script name is "PRE_$stage_$priority" and "POST_$stage_$priority"

3. the processing of script is the same as PRE_RECOVERY_SCRIPT and PRE_RECOVERY_SCRIPT.