百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
J

jenkins-backup-script

> DevOps
开源

存档 Jenkins 设置和插件

492 stars0 点赞5 次浏览
访问官网GitHub

工具介绍

存档 Jenkins 设置和插件

Jenkins backup script

Archive Jenkins settings and plugins

  • $JENKINS_HOME/*.xml
  • $JENKINS_HOME/*.jks
  • $JENKINS_HOME/jobs/*/*.xml
  • $JENKINS_HOME/nodes/*
  • $JENKINS_HOME/plugins/*.jpi
  • $JENKINS_HOME/secrets/*
  • $JENKINS_HOME/users/*

Usage

bash
./jenkins-backup.sh /path/to/jenkins_home archive.tar.gz

# add timestamp suffix
./jenkins-backup.sh /path/to/jenkins_home backup_`date +"%Y%m%d%H%M%S"`.tar.gz

run with Jenkins Job

1. install Exclusive Execution Plugin

https://wiki.jenkins-ci.org/display/JENKINS/Exclusive+Execution+Plugin

2. New Job

3. Configure

Source Code Management > Repository URL

https://github.com/sue445/jenkins-backup-script.git
  • Recommended : specify Branch Specifier with latest release tag
  • Check https://github.com/sue445/jenkins-backup-script/releases

Build Triggers > Build periodically

Build Environment > Set exclusive Execution

Build > Execute shell

ex.

bash
./jenkins-backup.sh $JENKINS_HOME /path/to/backup_`date +"%Y%m%d%H%M%S"`.tar.gz

Operability confirmed

  • Debian wheezy
  • Debian jessie
  • Debian stretch
  • Debian buster
  • CentOS 6
  • CentOS 7

Testing

requirements Docker

bash
bundle install

bundle exec itamae docker --node-yaml=spec/node.yml spec/recipes/bootstrap.rb --image=centos:7 --tag local:latest
DOCKER_IMAGE=local:latest bundle exec rspec

Tips

rotate backup files

bash
# keep backup with latest 30 days
find /path/to/backup_* -mtime +30 -delete

Restore commands

example

bash
sudo /etc/init.d/jenkins stop
cd /path/to/backup_dir
tar xzvf backup.tar.gz
sudo cp -R jenkins-backup/* /path/to/jenkins/
sudo chown jenkins:jenkins -R /path/to/jenkins/
sudo /etc/init.d/jenkins start

Changelog

CHANGELOG.md

Issues· 3 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubyjenkinsshell

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理