]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-volume-changer
Remove bashism in script
[bacula/bacula] / regress / tests / two-volume-changer
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory 
4 #  to two tapes where the maximum tape file size is set to 1M
5 #  Note, this test simulates the tape filling and writing to
6 #   the next tape.
7 #
8 TestName="two-volume-tape"
9 JobName=twovoltape
10 . scripts/functions
11
12 require_tape_drive
13 require_autochanger
14
15 scripts/cleanup
16 scripts/copy-2tape-confs
17 scripts/prepare-two-tapes
18  
19 echo "${cwd}/build" >${cwd}/tmp/file-list
20
21 outf="tmp/sed_tmp"
22 echo "s%# Maximum File Size%  Maximum File Size%g" >${outf}
23 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
24 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
25
26 change_jobname $JobName
27 start_test
28
29 # Write out bconsole commands
30 cat <<END_OF_DATA >tmp/bconcmds
31 @$out /dev/null
32 messages
33 @$out tmp/log1.out
34 label storage=DDS-4 volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1
35 label storage=DDS-4 volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1
36 update Volume=TestVolume001 MaxVolBytes=3000000 pool=Default drive=0
37 sql
38 select * from Storage;
39 select VolumeName,InChanger,Slot,StorageId from Media;
40
41 @#setdebug level=1000 client 
42 @#setdebug level=250 storage=DDS-4
43 run job=$JobName yes
44 wait
45 sql
46 select * from Storage;
47 select VolumeName,InChanger,Slot,StorageId from Media;
48
49 messages
50 quit
51 END_OF_DATA
52
53 run_bacula
54 check_for_zombie_jobs storage=DDS-4
55 stop_bacula
56
57 mt -f ${TAPE_DRIVE} rewind
58 mtx -f ${AUTOCHANGER} unload
59 sleep 15
60
61 cat <<END_OF_DATA >tmp/bconcmds
62 @$out /dev/null
63 messages
64 @# 
65 @# now do a restore
66 @#
67 @$out tmp/log2.out
68 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
69 yes
70 wait
71 messages
72 @$out
73 quit
74 END_OF_DATA
75
76 run_bacula
77 check_for_zombie_jobs storage=DDS-4
78 stop_bacula
79
80 check_two_logs
81 check_restore_diff
82 end_test