Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

Plugin Information

View Periodic Backup on the plugin site for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

This plugin is up for adoption. Want to help improve this plugin? Click here to learn more!

Description

This plugin was created as alternative to existing Backup Plugin that would work periodically.
The main idea was to create a backup plugin that provides an easy way to be extended with new functionality in the future without the need of hacking around the code.
The plugin defines three extension points (basically plugins inside the plugin):

  • FileManager - defines what files should be included in the backup and what will be the restore policy of the files. Example: ConfigOnly - will choose only the configuration XML files from HUDSON_HOME, all the configuration files of each job and the XML of every user if you are using an internal database for access control.
  • Storage - specifies method of archiving and unarchiving backups. Example: ZipStorage - will compress backup files into a zip archive.
  • Location - specifies localization of the backups. Example: LocalDirectory - will store the backup files inside the specified path.

Usage

  1. After installing the plugin and restarting Jenkins, new icon will appear in the Manage Jenkins section.
  2. After pressing Periodic Backup Manager in the side panel choose configure to set up the plugin.
  3. In the configuration page set all the required parameters which are:
    • Temporary Directory - path to the directory for creating archives during backup, storing archives during restore, and unpacking their content. It is vital for PeriodicBackup that this directory is writable, empty, and outside of the Jenkins home directory.
    • Backup schedule (cron) - schedule following the syntax of cron (with minor differences). Validate cron button may be useful to check if the syntax of the input is correct. More about cron can be found here: http://adminschoice.com/crontab-quick-reference
    • Maximum backups in location - A number of existing old backups exceeding this value in each location will be deleted after backup.
    • Store no older than (days) - Backups older then number of days specified here will be deleted after backup.
    • File Management Strategy - choose a suitable FileManager and fill in required fields (if any)
    • Storage Strategy - add a suitable Storage(s) and fill in required fields (if any)
    • Backup Location - add a suitable Location(s) and fill in required fields (if any)

      Temporary Directory

      Please be aware the using a path inside Temporary Directory (for example for location like LocalDirectory) will lead to a very bad things (like loss of data).

  4. After setting up all values correctly and pressing Save button, configuration will be persisted and user will be redirected to the main page of the plugin. Any backup available for restore will be listed here, and one can navigate here via Restore link from the sidepanel. The backup will be performed according to the cron schedule or when Backup Now! is pressed from the sidepanel. A message will be shown on the top of the page as on the picture below.
  5. When the backup is successfully created it will be listed on the web page as on the picture below.

    To restore the backup it has to be chosen from the list and the "restore selected backup" button has to be pressed.

    Backup not showed/"Creating backup..."/"Restoring backup..." message does not disappear

    Sometimes the backup will not be shown on the web page just after performing the backup. Also the "Creating backup..."/"Restoring backup..." messages may not disappear from the page when they should. In that case page has to be refreshed or the link to Restore has to be pressed in order to show the new backup. This will be fixed in future by a widget informing about the current status of the backup/restore process

Change Log

Version 1.5 (July 10, 2017)

Version 1.4 (Jun 22, 2017)

  • (plus) JENKINS-17487 - Add support of excludes in Full Backup
  • (plus) PR #10 - Update minimal Jenkins core requirement to 1.609.3
  • (error) JENKINS-25887 - Do not follow symbolic links when performing Full Backups
  • (error) JENKINS-44997 - Restore the "Restore Backup" button, which was doing nothing in modern Jenkins UIs
  • (error) PR #10 - Prevent NullPointerException if an error happens during listing directories
  • (info) PR #10 - Internal: Update the release flow, fix generation of the Maven Site, FindBugs cleanup

Version 1.3 (Jan 4, 2013)

  • JENKINS-12846: Add support for backing up user XMLs in users folder.

Version 1.2 (Jan 3, 2013)

  • JENKINS-13635: TarGzStorage changed to GNU long file mode (long filenames up to 256 chars).
  • JENKINS-16223: Update plexus dependencies.

Version 1.0 (Jun 3, 2011)

  • Initial release

19 Comments

  1. Unknown User (hbockelmann)

    I just installed the plugin since we really need a periodic backup ... but there are some issues when running a backup:

    i/ in /var/log/jenkins/jenkins.log I see every minute an entry:

    Jun 10, 2011 9:04:55 AM hudson.model.AsyncPeriodicWork$1 run
    INFO: Started PeriodicBackup
    Jun 10, 2011 9:04:55 AM hudson.model.AsyncPeriodicWork$1 run
    INFO: Finished PeriodicBackup. 1 ms

    is it this really necessary to start every minute?

    ii/ when starting 'backup now!' jenkins says 'Creating backup...' but nothing happens. log file output is:

    Jun 10, 2011 9:06:47 AM hudson.model.AsyncPeriodicWork$1 run
    INFO: Started PeriodicBackup
    Jun 10, 2011 9:06:55 AM hudson.model.AsyncPeriodicWork doRun
    INFO: PeriodicBackup thread is still running. Execution aborted.

    No data is written - neither to 'Temporary Directory' nor to Backup Location''

    1. Unknown User (dienomight)

      i)

      PeriodicBackup is indeed called every minute, and does nothing if it doesn't have to. It is because of how AsyncPeriodicWork works.

      One way to avoid it in the future is using new AsyncAperiodicWork introduced in Jenkins 1.410 but the plugin will not work for users of older versions of Jenkins so we don't want to do it right now. 

      ii)

      I cannot reproduce this error. Have you checked if the 'Backup Location' is outside the 'Temporary Directory' ? 

      Can you give me some more details about how you configured the plugin? Does the periodic backup work if you (for example) set up cron to "*/1 * * * *" ?

      1. Unknown User (hbockelmann)

        Temporary Directory is '/tmp/'

        Backup directory path is '/home/myusername/jenkinsBackup'

        Backup schedule (cron) is '42 2 * * 0,4'

        FullBackups are created on Sunday and Thursday ... now problems!

        But 'Backup Now!' does not produce any backup

        1. Unknown User (dienomight)

          Your configuration is OK, I assume that you chose "tar.gz" as a Storage? Does "backup now" works for you if you choose "Config Only" instead of Full Backup?

          There is a problem with a logger, could you check hudson.err.log file in your JENKINS_HOME? All periodicbackup logs are redirected there apparently.

          1. Unknown User (hbockelmann)

            meanwhile I found out that backups are written correctly! it just takes a long time (about half an hour for 7.5M) ... sorry for bothering you.

            btw: there is no jenkins log available at all - neither in jenkins_home nor in /var/log/jenkins. since last compress of log at 2011-06-11 no more output can be found in /var/log/jenkins/jenkins.log

            1. Unknown User (dienomight)

              No problem. :) I'm glad that the backup is fine in the end. Now I see how important is a proper logger/status info mechanism.

  2. Unknown User (tomi_m)

    Hey,

    I try to find the option to be able to create a backup of other  multiple folders +¨config.xml. But I didn^t find it. Is there any option like this e.g. I want a backup userContent + config.xml of every job.

    Thanks

    Thomas

  3. Unknown User (bakito)

    Hi,

    I tried to make a FileManager extension.
    I failed, since the method getFilesToBackup() throws a PeriodicBackupException which is a package protected class wich can not be accessed from another jar.

    Can you either make the exception public or replace the throwed Exception with a public one?

    Regards,

    bakito

  4. Unknown User (xiongfeng)

    I installed this plugin to make the backup  work periodicly , but I found the cron does not work.

    I did the backup manually and the backup can be finished with no error.

    my configuration on cron bar :

    Backup schedule (cron):   50 16 * * *                                                    /* I just want it to run the backup everyday at 04:50 pm    */

    anyone ever been encountered this issue ? 

    thanks

    Xiong,Feng

  5. Unknown User (laurent_bourgeois)

    Hello,

    When I try to restore a ConfigOnly backup by selecting it and clicking on 'Restor selected backup' no request to server is fired when I inspect http traffic with Firebug.

    So configuration is not restored ...

    My installation is Jenkins 1.583 with Periodic Backup Plugin 1.3.

    Thanks in advance for your help.

    Laurent

    1. Unknown User (priya_rajput08)

      Hi Laurent,

      I am also facing same issue.

      Have you get the solution for this issue - Unable to Restore selected Backup ?

      I am using Jenkins V2.19.4 and Periodic Backup Plugin 1.3

      Thanks In Advance.

  6. Unknown User (fred_baud)

    Hi Team,

    I have been using the PeriodicBackup plugin for quite some time now. All working well, except that the 'Maximum backups in location' and 'Store no older than (days)' restrictions configured are not being taken into consideration.

    I originally enabled the plugin in June 2016 with Maximum backups in location=4 and Store no older than=10days and weekly backup execution. However, backups have kept on adding up ever since and I am now with 13 sets of backup.

    It does not seem to be a permission issue as the backup files are correctly created. Any suggestion on the root cause?

    Cheers, Fred

     
  7. Unknown User (rd31419)

    Hi,

    I am using periodic backup plugin and is working fine with respect to backups. But, I see these Async threads. Could you please suggest how to avoid these.

    Log:

    18-Oct-2016 12:51:45.368 INFO [PeriodicBackup thread] hudson.model.AsyncPeriodicWork$1.run Started PeriodicBackup

    18-Oct-2016 12:51:45.381 INFO [PeriodicBackup thread] hudson.model.AsyncPeriodicWork$1.run Finished PeriodicBackup. 2 ms

    18-Oct-2016 12:52:45.365 INFO [PeriodicBackup thread] hudson.model.AsyncPeriodicWork$1.run Started PeriodicBackup

    18-Oct-2016 12:52:45.379 INFO [PeriodicBackup thread] hudson.model.AsyncPeriodicWork$1.run Finished PeriodicBackup. 2 ms

    18-Oct-2016 12:53:45.362 INFO [PeriodicBackup thread] hudson.model.AsyncPeriodicWork$1.run Started PeriodicBackup

    18-Oct-2016 12:53:45.375 INFO [PeriodicBackup thread] hudson.model.AsyncPeriodicWork$1.run Finished PeriodicBackup. 2 ms

    18-Oct-2016 12:54:45.360 INFO [PeriodicBackup thread] hudson.model.AsyncPeriodicWork$1.run Started PeriodicBackup

    18-Oct-2016 12:54:45.373 INFO [PeriodicBackup thread] hudson.model.AsyncPeriodicWork$1.run Finished PeriodicBackup. 2 ms

    I am using Jenkins 2.7.4 version.

    tmp directory is: D:\tmp

    backup directory is: D:\Jenkins\Periodic-Backups

    Thanks in advance.

    R Dama

  8. Unknown User (rd31419)

    18-Oct-2016 15:00:45.023 INFO [jenkins.util.Timer [#8]] hudson.model.AsyncPeriodicWork.doRun PeriodicBackup thread is still running. Execution aborted.

    Though the periodic backup plugin schedule changed, I see above message.

  9. Unknown User (priya_rajput08)

    hi,

    I am able to take backup by scheduling with Cron and also with Backup Now option.

    But I am not able to restore backup by clicking on 'Restore Selected Backup' button, no request is fired to server when I inspect http traffic with Firebug.

    I am using Jenkins V 2.19.4 and  Periodic Backup Plugin 1.3

    Any suggestion for this issue?

    Thanks

    1. Unknown User (oleg_nenashev)

      See JENKINS-44997 - Getting issue details... STATUS

  10. Unknown User (max_ua)

    Hello,

    I want to try this plugin for backups, but have a few questions:

    1. Temporary Directory, if I'll setup /tmp/ as it, how much disk space will be used during/after backup, I ask this question as I backup to different physical volume and have a limited space on main volume. If i'll need to backup whole jenkins_home folder(about 70GB), will plugin handle it through temp dir file by file, or create one big archive in it before?
    2. Is it safe to perform backup when some jobs are running?
  11. Unknown User (robco)

    Hey,

     

    is it possible to exclude directories from the backup?

    I only want to backup my jobs directory and can't get it to work.

     

    Kind regards,

    Robin

  12. Unknown User (gotviserion)

    1) When I did a full backup, I saw a couple of folders were not backed up.  (They were empty though).

    2) I have a new Jenkins setup (nothing configured in it).  Installed the plugin and did a restoration from the backup from (1) it didn't restore anything.  But, when I moved the contents from the backup to the Jenkins folder replacing the older ones, all the configuration was present in the new Jenkins.

    Is this how the restoration works?