HoneyMoose
  • 首页
  • Java
  • Jersey
  • Jira
  • Confluence
  • U.S.
    • USRealEstate
    • U.S. Travel
    • H1B
  • 项目和网站
    • CWIKI.US
    • OSSEZ 社区
    • WIKI.OSSEZ.COM
    • BUG.OSSEZ.COM
    • RSS.OSSEZ.COM
BLOG.OSSEZ.COM
A responsive blog theme focused om user reading experience
  1. Home
  2. Computer Science
  3. Confluence
  4. This article

Confluence 6 用户提交的备份和恢复脚本

2018年06月18日 421Browse 0Like 0Comments

下面的代码是用户提交的,在使用的时候需要小心,因为 Atlassian 不提供这些代码的技术支持。如果你在使用或者修改这些代码的时候有任何问题,请粘贴到 post them to Atlassian Answers。

删除老的备份 —— Windows 的 Wscript 脚本

这个脚本将会检查备份文件然后删除他们(必要的话),下面的代码可能需要一些编辑。

'If you want 3 day old files to be deleted then insert 3 next to Date - "your number here"
'This script will search out and delete files with this string in them ".2005-12-04-" This of course depends on the number you enter.
'You can always do a wscript.echo strYesterday or strFileName to see what the script thinks you are searching for.
dtmYesterday = Date - 3
strYear = Year(dtmYesterday)
strMonth = Month(dtmYesterday)
If Len(strMonth) = 1 Then
    strMonth = "0" & strMonth
End If
strDay = Day(dtmYesterday)
If Len(strDay) = 1 Then
    strDay = "0" & strDay
End If
strYesterday = strYear & "-" & strMonth & "-" & strDay
strFileName = "C:\test*." & strYesterday &"-*"
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(strFileName)

删除老的备份 ——  Linux Basic Bash Script

Old 的 XML 备份可以通过每天晚上或者每周的自动运行脚本进行删除。你也可以在 cron 中设置相似的脚本:

ls -t <path to your backup dir>/* | tail -n +6 | xargs -i rm {}

或者,使用 tail 命令,如果你的系统不支持标准格式的话:

ls -t <path to your backup dir>/* | tail +6 | xargs -i rm {}

Del 删除老的备份 —— 高级 Linux  Bash Script

Old 的 XML 备份可以通过每天晚上或者每周的自动运行脚本进行删除,针对你的站点设置 BACKUP_DIR 和 DAYS_TO_RETAIN 变量。在运行之间,相对 DAYS_TO_RETAIN 更多文件将会构建。

#!/bin/sh
# Script to remove the older Confluence backup files.
# Currently we retain at least the last two weeks worth
# of backup files in order to restore if needed.
BACKUP_DIR="/data/web/confluence/backups"
DAYS_TO_RETAIN=14
find $BACKUP_DIR -maxdepth 1 -type f -ctime +$DAYS_TO_RETAIN -delete

手动数据库和 Home 目录备份 —— Linux Basic Bash Script

这个将会备份 MySQL 数据库和 Confluence 的 Home 目录。

#!/bin/bash
CNFL=/var/confluence
CNFL_BACKUP=/backup/cnflBackup/`date +%Y%m%d-%H%M%S`
rm -rf $CNFL/temp/*
mkdir $CNFL_BACKUP
mysqldump -uroot -p<password> confluence|gzip > $CNFL_BACKUP/confluence.mysql.data.gz
tar -cjvf $CNFL_BACKUP/data.bzip $CNFL > $CNFL_BACKUP/homedir.status

按照日期备份 —— Postgres

export d=`date +%u`
mkdir -p /home/backup/postgres/$d
sudo -u postgres pg_dumpall | bzip2 > /home/backup/postgres/$d/sql.bz2

 

https://www.cwiki.us/pages/viewpage.action?pageId=33004943

Tags: Confluence
Last updated:2018年06月18日

Kratos

stay absorbed stay excellent

Like
< Previous
Next >

Comments

Cancel reply

Newest Hotspots Random
Newest Hotspots Random
网络编程常用的几种字符编码 Java 中的 String Pool 简介 有关 Java 9 的 String Java String 性能和优化 Java String 手工引用指针 Java String 文字(Literal)和 对象(Object)初始化
Jenkins 通过检查代码提交自动触发编译IntelliJ IDEA 2022 年版本中的作者提示Discourse 新用户可插入媒体的数量Discourse 的信任级别Java 使用 char[] Array 还是 String 存储字符串密码Java 字符串引用(String Interning)
Confluence 6 生产环境备份策略 Confluence 6 管理全站权限和用户组 Junit-jupiter-api 和 junit-jupiter-engine 的区别是什么 Confluence 的顶部导航是在那里配置的 JUnit 5 测试 Spring 引擎的时候提示 junit-vintage 错误 Confluence 6 查看一个任务的执行历史
Categories
  • Akka
  • Algorithm(算法)
  • AMQP
  • Angular
  • CI
  • Compile And CI
  • Computer Science
  • Confluence
  • DataBase
  • Gradle
  • H1B
  • Hibernate
  • IDE
  • Java
  • Jersey
  • Jira
  • MariaDB
  • PrestaShop
  • Spring
  • Spring Batch
  • U.S.
  • U.S. Travel
  • USRealEstate
  • 我的小厨

COPYRIGHT © 2020 HoneyMoose. ALL RIGHTS RESERVED.

THEME CWIKIUS.CN MADE BY VTROIS