ユーザーがサブミットしたバックアップと復元のスクリプト

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

These scripts are user-submitted and should be used with caution as they are not covered by Atlassian technical support. If you have questions on how to use or modify these scripts, please post them to Atlassian Answers

古いバックアップの削除 - Windows の Wscript Script

このスクリプトはバックアップファイル名を調べ、必要に応じて削除します。編集が必要となる場合があります。

'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

夜間や週次自動スクリプト、または以下のような cron を挿入することで、古い XML バックアップは自動的に削除される場合があります。

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 {}

古いバックアップの削除 - Linux 用の高度な Bash スクリプト

夜間や週次自動スクリプト、または以下のような cron を挿入することで、古い 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

手動によるデータベースとホームのバックアップ - Bash Script For Linux

mySQL データベースと Confluence ホーム ディレクトリのバックアップを作成します。

#!/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
最終更新日: 2020 年 12 月 14 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.