-
Notifications
You must be signed in to change notification settings - Fork 256
/
bad-label-changer
executable file
·85 lines (70 loc) · 1.69 KB
/
bad-label-changer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh
#
# Label two tapes, write to the first, then recycle it and destroy
# the header. Bareos should discover that, mark the tape in
# error and continue onto the second tape.
#
TestName="bad-label-changer"
JobName=badlabelchanger
. scripts/functions
require_tape_drive
require_autochanger
scripts/cleanup
scripts/copy-2tape-confs
scripts/prepare-two-tapes
#outf="tmp/sed_tmp"
#echo "s%# Maximum File Size% Maximum File Size%g" >${outf}
#cp ${cwd}/bin/bareos-sd.conf ${cwd}/tmp/1
#sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bareos-sd.conf
change_jobname $JobName
# Directory to backup.
# This directory will be created by setup_data().
BackupDirectory="${tmp}/data"
# Use a tgz to setup data to be backed up.
# Data will be placed at "${tmp}/data/".
setup_data data/small.tgz
start_test
# Write out bconsole commands
cat <<END_OF_DATA >tmp/bconcmds
@$out /dev/null
messages
@$out tmp/log1.out
label storage=tape volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1
label storage=tape volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1
list volumes
@#setdebug level=10 client=$CLIENT
setdebug level=150 storage=tape
run job=$JobName yes
wait
purge volume=TestVolume001
messages
quit
END_OF_DATA
run_bareos
check_for_zombie_jobs storage=tape
stop_bareos
# Overwrite TestVolume001 label
init_drive ${TAPE_DRIVE}
cat <<END_OF_DATA >tmp/bconcmds
@$out /dev/null
messages
list volumes
run job=$JobName level=Full storage=tape yes
wait
messages
@#
@# now do a restore
@#
@$out tmp/log2.out
restore where=${cwd}/tmp/bareos-restores select all storage=tape done
yes
wait
messages
quit
END_OF_DATA
run_bareos
check_for_zombie_jobs storage=tape
stop_bareos
check_two_logs
check_restore_diff
end_test