-
Notifications
You must be signed in to change notification settings - Fork 256
/
ansi-label-tape
executable file
·103 lines (90 loc) · 2.2 KB
/
ansi-label-tape
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh
#
# Test of ANSI labeled tapes
#
# Run a simple backup of the Bareos build directory
# to a tape then restore it, we do that twice to ensure that
# we can correctly append to a tape.
# We also use the purge and the relabel commands as
# well as a pile of status storage commands.
#
TestName="ansi-label-tape"
JobName=backuptape
. scripts/functions
require_tape_drive
scripts/cleanup-tape
scripts/copy-tape-confs
/bin/cp -f scripts/ansi-sd-tape.conf bin/bareos-sd.conf
# 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
# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
echo "${BackupDirectory}" >${tmp}/file-list
change_jobname NightlySave $JobName
start_test
# Write out bconsole commands
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/log1.out
setdebug level=200 storage=tape
label storage=tape volume=Vol001 slot=0 pool=Default
purge volume=Vol001
relabel pool=Default storage=tape oldVolume=Vol001 volume=Vol002 slot=0
purge volume=Vol002
relabel pool=Default storage=tape oldVolume=Vol002 volume=Vol001 slot=0
run job=$JobName yes
status storage=tape
@sleep 1
wait
messages
@#
@# now do a restore
@#
@$out ${cwd}/tmp/log2.out
setdebug level=200 storage=tape
restore where=${cwd}/tmp/bareos-restores select all storage=tape done
yes
wait
list volumes
messages
END_OF_DATA
run_bareos
check_for_zombie_jobs storage=tape
stop_bareos
#
# Now do a second backup after making a few changes
#
find ${BackupDirectory} -name *.c -exec touch {} \;
echo "test test" > ${BackupDirectory}/xxx
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/log1.out
list volumes
@#setdebug level=300 storage=tape
run job=$JobName yes
wait
list volumes
messages
@#
@# now do a second restore
@#
@$out ${cwd}/tmp/log2.out
list volumes
restore where=${cwd}/tmp/bareos-restores select all storage=tape done
yes
wait
list volumes
messages
quit
END_OF_DATA
run_bareos
check_for_zombie_jobs storage=tape
stop_bareos
check_two_logs
check_restore_diff ${BackupDirectory}
end_test