Skip to content

Commit 57a3aed

Browse files
committed
Merge branch 'devel'
2 parents 613116a + b909957 commit 57a3aed

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

lib/storage.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function ib_storage_run () {
3434
local storageName="$1"
3535
local taskName="$2"
3636
local itemName="$3"
37+
local itemTag="$4"
3738

3839
for storage in $IB_STORAGES
3940
do
@@ -42,13 +43,13 @@ function ib_storage_run () {
4243
local storageType=$(ib_get_conf_value "IB_STORAGE_${storageName}_TYPE")
4344
case "$storageType" in
4445
swift)
45-
ib_storage_swift_run "$storageName" "$taskName" "$itemName" || return -1
46+
ib_storage_swift_run "$storageName" "$taskName" "$itemName" "$itemTag" || return -1
4647
;;
4748
fs)
48-
ib_storage_fs_run "$storageName" "$taskName" "$itemName" || return -1
49+
ib_storage_fs_run "$storageName" "$taskName" "$itemName" "$itemTag" || return -1
4950
;;
5051
ssh)
51-
ib_storage_ssh_run "$storageName" "$taskName" "$itemName" || return -1
52+
ib_storage_ssh_run "$storageName" "$taskName" "$itemName" "$itemTag" || return -1
5253
;;
5354
*)
5455
echo "Unknow storage type [$storageType]"

lib/storages/fs.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function ib_storage_fs_run() {
3535
local storageName="$1"
3636
local taskName="$2"
3737
local itemName="$3"
38+
local itemTag="$4"
3839
local fsBasePath=$(ib_get_conf_value "IB_STORAGE_${storageName}_BASEPATH")
3940

4041
if [ -z "$fsBasePath" ]
@@ -43,7 +44,13 @@ function ib_storage_fs_run() {
4344
return -1
4445
fi
4546

46-
local fileName="${fsBasePath}/${taskName}/${DATE}/${itemName}"
47+
local folderName="${DATE}"
48+
if [ ! -z "$itemTag" ]
49+
then
50+
folderName="${folderName}-${itemTag}"
51+
fi
52+
53+
local fileName="${fsBasePath}/${taskName}/${folderName}/${itemName}"
4754
mkdir -p $(dirname "$fileName")
4855
cat > "${fileName}"
4956
}

lib/storages/ssh.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function ib_storage_ssh_run() {
3535
local storageName="$1"
3636
local taskName="$2"
3737
local itemName="$3"
38+
local itemTag="$4"
3839
local sshUser=$(ib_get_conf_value "IB_STORAGE_${storageName}_USER")
3940
local sshHost=$(ib_get_conf_value "IB_STORAGE_${storageName}_HOST")
4041
local sshPort=$(ib_get_conf_value "IB_STORAGE_${storageName}_PORT")
@@ -58,7 +59,13 @@ function ib_storage_ssh_run() {
5859
sshKey="-i ${sshKey}"
5960
fi
6061

61-
local fileName="${sshBasePath}/${taskName}/${DATE}/${itemName}"
62+
local folderName="${DATE}"
63+
if [ ! -z "$itemTag" ]
64+
then
65+
folderName="${folderName}-${itemTag}"
66+
fi
67+
68+
local fileName="${sshBasePath}/${taskName}/${folderName}/${itemName}"
6269
ssh "${sshUser}@${sshHost}" $sshKey -p "${sshPort}" \
6370
"mkdir -p \"\$(dirname '${fileName}')\" ; cat > '${fileName}'"
6471
}

lib/storages/swift.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function ib_storage_swift_run () {
3535
local storageName="$1"
3636
local taskName="$2"
3737
local itemName="$3"
38+
local itemTag="$4"
3839
local swiftAuthUrl=$(ib_get_conf_value "IB_STORAGE_${storageName}_AUTHURL")
3940
local swiftUser=$(ib_get_conf_value "IB_STORAGE_${storageName}_USER")
4041
local swiftPassword=$(ib_get_conf_value "IB_STORAGE_${storageName}_PASSWORD")
@@ -53,6 +54,12 @@ function ib_storage_swift_run () {
5354
swiftSplitSize="2G"
5455
fi
5556

57+
local folderName="${DATE}"
58+
if [ ! -z "$itemTag" ]
59+
then
60+
folderName="${folderName}-${itemTag}"
61+
fi
62+
5663
stdin2swift -a "$swiftAuthUrl" -u "$swiftUser" -p "$swiftPassword" -s "$swiftSplitSize" \
57-
"$swiftContainer" "${swiftBasePath}/${taskName}/${DATE}/${itemName}"
64+
"$swiftContainer" "${swiftBasePath}/${taskName}/${folderName}/${itemName}"
5865
}

lib/tasks/tarball-incremental.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function ib_task_tarball-incremental_run() {
3636
local storageName=$(ib_get_conf_value "IB_TASK_${taskName}_STORAGE")
3737
local masterFrequency=$(ib_get_conf_value "IB_TASK_data2_MASTER_FREQUENCY")
3838
local masterFrequencyValue=$(ib_get_conf_value "IB_TASK_data2_MASTER_FREQUENCY_VALUE")
39+
local masterTag=""
3940

4041
if [ -z "$storageName" ]; then echo "No valid IB_TASK_${taskName}_STORAGE found"; return -1; fi
4142
if [ -z "$listFile" ]; then echo "No valid IB_TASK_${taskName}_LIST_FILE found"; return -1; fi
@@ -57,13 +58,13 @@ function ib_task_tarball-incremental_run() {
5758
masterFrequencyValue=1
5859
fi
5960

60-
echo $masterFrequency $masterFrequencyValue
6161
if [[ (( "$masterFrequency" == "weekly" ) && ( $(date "+%u") -eq "$masterFrequencyValue" )) || \
6262
(( "$masterFrequency" == "monthly" ) && ( $(date "+%d") -eq "$masterFrequencyValue" )) ]]
6363
then
6464
rm -f "$listFile"
65+
masterTag="master"
6566
fi
6667

6768
tar --create -z --listed-incremental=$listFile $folders \
68-
| ib_storage_run $storageName $taskName "${fileBaseName}-${DATE}.tar.gz"
69+
| ib_storage_run $storageName $taskName "${fileBaseName}-${DATE}.tar.gz" "${masterTag}"
6970
}

0 commit comments

Comments
 (0)