Results 1 to 5 of 5

Thread: Using post-backup-plugin option in .conf

  1. #1

    Default Using post-backup-plugin option in .conf

    Hi everyone,

    Iím currently struggling with the post-backup-plugin option for zrm 2.1,. It seems like every time I run a backup, the post backup script I have produced is called twice. Have anyone notice this before? If I print some output to the screen, I can see that is only displayed once when running the zrm-scheduler, so it looks like it only run once. However, if the script is writing to a file, then this is done twice. It seems like the arguments also changes from the first run to the second. My script looks like this:

    Code:
     open(QUEUE,">>test.txt") || die("This file will not open!");
    print QUEUE "value: $ARGV[3]\n";
    close(QUEUE);
    exit(0);
    After one zrm-scheduler run, the output in the file is:

    Code:
    value: /var/lib/mysql-zrm/backup1/20090409195420
    value: --checksum-finished
    Can someone explain this Ė and why does the argument change?

    The purpose of the script is to have the current backup-destination printed to a file. How do I find a workaround to get this to work? Is it possible to find out which type of backup I have ran and have it parsed into the perl script as well? I can see that the index file is written after the script, so I cannot fetch the information from there.

    Best regards
    R.

  2. #2
    Join Date
    Oct 2005
    Posts
    1,559

    Default

    See comments in post-backup plugin template (/usr/share/mysql-zrm/plugins/post-backup.pl). It should answer your question. I think you are looking for backup-directory.

    # Parameters passed to the plugin
    # -------------------------------
    # First parameter is the value of "post-backup-plugin-options" from the
    # mysql-zrm.conf(5) configuration file.
    # Second parameter is the data being backed up. It will be either
    # '--all-databases' or
    # '--databases <"db1 db2 ...">' or
    # '--database <db>' and '--tables <"table1 table2 ...">'
    # Third parameter will be --backup-directory <path>
    # Fourth parameter will be --checksum-pending
    #
    # The second time the post-backup-plugin is called it will have 2 parameters
    # First parameter will be --backup-directory <path>
    # Second parameter will be --checksum-finished

  3. #3

    Default

    Hi paddy,

    Thanks for the quick answer. So the post-backup plugin are called to times for each zrm-scheduler run? When is it called first time and second?, and what are the reason for that? Do I have any chance to check, whether it is called 1. or 2. - maybe by counting the total argument list? So the solution for me, might be something about checking wheither argument third or first will look like a path.

    Is it possible to find our what type of backup-level that the current job is running if it has been started with parameter, eg. mysql-zrm-scheduler --now --backup-set backup1 --backup-level 1, then I want to do something specific with the backup in the post-backup plugin, if it e.g. is a full backup.

    Best regards.
    R.

  4. #4
    Join Date
    Oct 2005
    Posts
    1,559

    Default

    Quote Originally Posted by roccos View Post
    Hi paddy,

    Thanks for the quick answer. So the post-backup plugin are called to times for each zrm-scheduler run? When is it called first time and second?, and what are the reason for that? Do I have any chance to check, whether it is called 1. or 2. - maybe by counting the total argument list? So the solution for me, might be something about checking wheither argument third or first will look like a path.

    Is it possible to find our what type of backup-level that the current job is running if it has been started with parameter, eg. mysql-zrm-scheduler --now --backup-set backup1 --backup-level 1, then I want to do something specific with the backup in the post-backup plugin, if it e.g. is a full backup.

    Best regards.
    R.
    It is called before and after checksums are computed. You have to differentiate between based on the argument passed (--checksum-pending and --checksum-finished).

    You should be able to look the configuration (includes backup-level passed
    as argument). It is available in ZRM_CONF env variable. See parseConfFile() in encrypt-plugin.pl for an example.

    Paddy

  5. #5

    Default

    That did the trick, thank you.

    R.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •