]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-2media-tape
Backport from Bacula Enterprise
[bacula/bacula] / regress / tests / incremental-2media-tape
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory then create some           
9 #   new files, do an Incremental onto a different medium 
10 #   and then restore everything.
11 #
12 # This script uses the two different tape drives.
13 #
14 TestName="incremental-2media-tape"
15 JobName=Inc2mediaTape
16 . scripts/functions
17
18 require_tape_drive
19 require_second_drive
20
21 scripts/cleanup
22 # Get conf files
23 /bin/cp -f scripts/bacula-dir-2d.conf bin/bacula-dir.conf
24 /bin/cp -f scripts/bacula-sd-2d.conf bin/bacula-sd.conf
25 /bin/cp -f scripts/bacula-fd-2d.conf bin/bacula-fd.conf
26 /bin/cp -f scripts/bconsole-2d.conf bin/bconsole.conf
27
28 # get proper SD tape definitions
29 cp -f scripts/linux_tape_options bin/tape_options
30 if test x`uname` = xFreeBSD ; then
31    cp -f scripts/freebsd_tape_options bin/tape_options
32 fi
33
34 mt -f /dev/nst0 rewind
35 mt -f /dev/nst0 weof
36 mt -f /dev/nst1 rewind
37 mt -f /dev/nst1 weof
38
39 echo "${cwd}/build" >${cwd}/tmp/file-list
40
41 change_jobname $JobName
42 start_test
43
44 # Write out bconsole commands
45 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
46 @$out /dev/null
47 messages
48 @$out ${cwd}/tmp/log1.out
49 label storage=tape volume=TestVolume001 slot=$SLOT1 Pool=Default drive=$DRIVE1
50 label storage=DLT80 volume=TestVolume002 Pool=Default
51 run job=$JobName yes
52 wait
53 messages
54 quit
55 END_OF_DATA
56
57 run_bacula
58
59 echo "Backup 1 done"
60 # make some files for the incremental to pick up
61 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
62 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
63
64 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
65 @$out /dev/null
66 messages
67 @$out ${cwd}/tmp/log1.out
68 @# Force Incremental on the second Volume
69 update volume=TestVolume001 VolStatus=Used
70 setdebug level=51 storage=DLT80
71 run level=Incremental job=$JobName storage=DLT80 yes
72 wait
73 list volumes
74 messages
75 @# 
76 @# now do a restore
77 @#
78 @$out ${cwd}/tmp/log2.out
79 setdebug level=51 storage=tape
80 restore where=${cwd}/tmp/bacula-restores select all done 
81 yes
82 wait
83 messages
84 quit
85 END_OF_DATA
86
87 run_bconsole
88
89 check_for_zombie_jobs storage=DLT80
90 stop_bacula
91
92 check_two_logs
93 check_restore_diff
94
95 end_test