]> git.sur5r.net Git - bacula/bacula/blob - bacula/examples/backup-to-cdwriter.txt
Doc + ignore label errors option in bls
[bacula/bacula] / bacula / examples / backup-to-cdwriter.txt
1 From bacula-users-admin@lists.sourceforge.net Sat Jan 31 05:42:42 2004
2 Return-Path: <bacula-users-admin@lists.sourceforge.net>
3 Received: from sc8-sf-list2.sourceforge.net (lists.sourceforge.net
4         [66.35.250.206]) by matou.sibbald.com (8.12.10/8.12.10) with ESMTP id
5         i0V4ggtH005859 for <kern@sibbald.com>; Sat, 31 Jan 2004 05:42:42 +0100
6 Received: from localhost ([127.0.0.1] helo=projects.sourceforge.net) by
7         sc8-sf-list2.sourceforge.net with esmtp (Exim 4.30) id 1Amms2-0004RT-4e;
8         Fri, 30 Jan 2004 20:36:38 -0800
9 Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.11]
10         helo=sc8-sf-mx1.sourceforge.net) by sc8-sf-list2.sourceforge.net with esmtp
11         (Exim 4.30) id 1Ammo5-0002Tt-2F for bacula-users@lists.sourceforge.net;
12         Fri, 30 Jan 2004 20:32:33 -0800
13 Received: from www.abis.be ([195.0.32.120] helo=xenophon.abis.be) by
14         sc8-sf-mx1.sourceforge.net with esmtp (Exim 4.30) id 1AmbFN-0008Hu-99 for
15         bacula-users@lists.sourceforge.net; Fri, 30 Jan 2004 08:11:57 -0800
16 Received: from tosfeb32.abis.be ([194.78.5.1]) by xenophon.abis.be
17         (8.11.6/8.11.6) with SMTP id i0UGBI715849 for
18         <bacula-users@lists.sourceforge.net>; Fri, 30 Jan 2004 17:11:18 +0100
19 Received: by tosfeb32.abis.be(Lotus SMTP MTA v4.6.5  (863.2 5-20-1999))  id
20         C1256E2B.0058F4EE ; Fri, 30 Jan 2004 17:11:38 +0100
21 X-Lotus-FromDomain: ABIS
22 From: "Johan Decock" <jdecock@abis.be>
23 To: bacula-users@lists.sourceforge.net
24 Message-ID: <C1256E2B.0058F381.00@tosfeb32.abis.be>
25 Subject: Re: [Bacula-users] cdwriter
26 Mime-Version: 1.0
27 Content-type: multipart/mixed;  Boundary="0__=dQlRuu8umGKzn67woQcbAbtp1kVJLJuYIqUZPSjcX1GgjEHuWdvHDqOX"
28 Content-Disposition: inline
29 X-Spam-Score: 1.1 (+)
30 X-Spam-Report: Spam Filtering performed by sourceforge.net. See
31         http://spamassassin.org/tag/ for more details. Report problems to
32         http://sf.net/tracker/?func=add&group_id=1&atid=200001 1.1
33         MIME_BASE64_LATIN      RAW: Latin alphabet text using base64 encoding
34 Sender: bacula-users-admin@lists.sourceforge.net
35 Errors-To: bacula-users-admin@lists.sourceforge.net
36 X-BeenThere: bacula-users@lists.sourceforge.net
37 X-Mailman-Version: 2.0.9-sf.net
38 Precedence: bulk
39 List-Unsubscribe:
40         <https://lists.sourceforge.net/lists/listinfo/bacula-users>,
41         <mailto:bacula-users-request@lists.sourceforge.net?subject=unsubscribe>
42 List-Id: Bacula user's email list for support and discussions
43         <bacula-users.lists.sourceforge.net>
44 List-Post: <mailto:bacula-users@lists.sourceforge.net>
45 List-Help: <mailto:bacula-users-request@lists.sourceforge.net?subject=help>
46 List-Subscribe:
47         <https://lists.sourceforge.net/lists/listinfo/bacula-users>,
48         <mailto:bacula-users-request@lists.sourceforge.net?subject=subscribe>
49 List-Archive:
50         <http://sourceforge.net/mailarchive/forum.php?forum=bacula-users>
51 Date: Fri, 30 Jan 2004 17:11:34 +0100
52
53
54 --0__=dQlRuu8umGKzn67woQcbAbtp1kVJLJuYIqUZPSjcX1GgjEHuWdvHDqOX
55 Content-type: text/plain; charset=us-ascii
56 Content-Disposition: inline
57 Content-Transfer-Encoding: 8bit
58
59
60
61 Hi Alex,
62
63 I thought it would be easy to find them in the archives. I'll post them again. I changed some things in them anyway in the mean time. I also include the Director config. Then you see how they are to be used in Runbefore- and RunafterJobs
64
65 I'm interested in any remarks or improvements you might have. (I'm still getting started in shell scripting)
66
67
68 #
69 # Default Bacula Director Configuration file
70 #
71 #  The only thing that MUST be changed is to add one or more
72 #   file or directory names in the Include directive of the
73 #   FileSet resource.
74 #
75 #  For Bacula release 1.32b (14 Oct 2003) -- mandrake (FiveStar)
76 #
77 #  You might also want to change the default email address
78 #   from root to your address.  See the "mail" and "operator"
79 #   directives in the Messages resource.
80 #
81
82 Director {                  # define myself
83   Name = tosfeb33-dir
84   DIRport = 9101            # where we listen for UA connections
85   QueryFile = "/etc/bacula/query.sql"
86   WorkingDirectory = "/var/bacula/working"
87   PidDirectory = "/var/run"
88   Maximum Concurrent Jobs = 1
89   Password = "abis"         # Console password
90   Messages = Standard
91 }
92
93 Job {
94   Name = "Tosfeb31AllHDD"
95   Type = Backup
96   Level = Full
97   Client = tosfeb31-fd
98   FileSet = "Tosfeb31All"
99   Schedule = "Weekdays"
100   Messages = Standard
101   Pool = HDD
102   Storage = HDdrive
103   RunBeforeJob = "/etc/bacula/prepare_DVDspool /mnt/backupdaily 1700000"
104   Write Bootstrap = "/var/bacula/working/Tosfeb31All.bsr"
105   Priority = 10
106 }
107
108 Job {
109   Name = "Tosfeb31AllUSB"
110   Type = Backup
111   Level = Full
112   Client = tosfeb31-fd
113   FileSet = "Tosfeb31All"
114   Schedule = "WeeklyUSB"
115   Messages = Standard
116   Pool = USB
117   Storage = USBdrive
118   Write Bootstrap = "/var/bacula/working/Tosfeb31All.bsr"
119   Priority = 10
120 }
121
122 Job {
123   Name = "Tosfeb31EssentialDVD"
124   Type = Backup
125   Level = Full
126   Client = tosfeb31-fd
127   FileSet = "Tosfeb31Essential"
128   Schedule = "MonthlyDVD"
129   Messages = Standard
130   Pool = DVD
131   Storage = DVDdrive
132   RunBeforeJob = "/etc/bacula/prepare_DVDspool /mnt/backupdaily 4700000"
133   Write Bootstrap = "/var/bacula/working/Tosfeb31Essential.bsr"
134   RunAfterJob = "/etc/bacula/inventorize_volumes %v"
135   Priority = 10
136 }
137
138 Job {
139   Name = "Tosfeb31AllCompressedDVD"
140   Type = Backup
141   Level = Full
142   Client = tosfeb31-fd
143   FileSet = "Tosfeb31AllCompressed"
144   Messages = Standard
145   Pool = DVD
146   Storage = DVDdrive
147   RunBeforeJob = "/etc/bacula/prepare_DVDspool /mnt/backupdaily 4700000"
148   Write Bootstrap = "/var/bacula/working/Tosfeb31Essential.bsr"
149   RunAfterJob = "/etc/bacula/inventorize_volumes %v"
150   Priority = 10
151 }
152
153 Job {
154   Name = "Tosfeb32AllHDD"
155   Type = Backup
156   Level = Full
157   Client = tosfeb32-fd
158   FileSet = "Tosfeb32All"
159   Schedule = "Weekdays"
160   Messages = Standard
161   Pool = HDD
162   Storage = HDdrive
163   Write Bootstrap = "/var/bacula/working/Tosfeb32All.bsr"
164   Priority = 20
165 }
166
167 Job {
168   Name = "Tosfeb32AllUSB"
169   Type = Backup
170   Level = Full
171   Client = tosfeb32-fd
172   FileSet = "Tosfeb32All"
173   Schedule = "WeeklyUSB"
174   Messages = Standard
175   Pool = USB
176   Storage = USBdrive
177   Write Bootstrap = "/var/bacula/working/Tosfeb32All.bsr"
178   Priority = 10
179 }
180
181 Job {
182   Name = "Tosfeb32EssentialDVD"
183   Type = Backup
184   Level = Full
185   Client = tosfeb32-fd
186   FileSet = "Tosfeb32Essential"
187   Schedule = "MonthlyDVD"
188   Messages = Standard
189   Pool = DVD
190   Storage = DVDdrive
191   Write Bootstrap = "/var/bacula/working/Tosfeb32System.bsr"
192   RunAfterJob = "/etc/bacula/inventorize_volumes %v"
193   Priority = 20
194 }
195
196 #Job {
197 #  Name = "Tosfeb30System"
198 #  Type = Backup
199 #  Level = Full
200 #  Client = tosfeb30-fd
201 #  FileSet = "Tosfeb30System"
202 #  Schedule = "WeeklyUSB"
203 #  Messages = Standard
204 #  Pool = USB
205 #  Storage = USBdrive
206 #  Write Bootstrap = "/etc/bacula/working/Tosfeb32System.bsr"
207 #  Priority = 20
208 #}
209
210 Job {
211   Name = "Tosfeb33SystemHDD"
212   Type = Backup
213   Level = Full
214   Client = tosfeb33-fd
215   FileSet = "Tosfeb33System"
216   Schedule = "Weekdays"
217   Messages = Standard
218   Pool = HDD
219   Storage = HDdrive
220   Write Bootstrap = "/var/bacula/working/Tosfeb33System.bsr"
221   Priority = 30
222 }
223
224 Job {
225   Name = "Tosfeb33SystemUSB"
226   Type = Backup
227   Level = Full
228   Client = tosfeb33-fd
229   FileSet = "Tosfeb33System"
230   Schedule = "WeeklyUSB"
231   Messages = Standard
232   Pool = USB
233   Storage = USBdrive
234   Write Bootstrap = "/var/bacula/working/Tosfeb33All.bsr"
235   Priority = 30
236 }
237
238 Job {
239   Name = "Tosfeb33EssentialDVD"
240   Type = Backup
241   Level = Full
242   Client = tosfeb33-fd
243   FileSet = "Tosfeb33Essential"
244   Schedule = "MonthlyDVD"
245   Messages = Standard
246   Pool = DVD
247   Storage = DVDdrive
248   Write Bootstrap = "/var/bacula/working/Tosfeb33Essential.bsr"
249   RunAfterJob = "/etc/bacula/inventorize_volumes %v"
250   Priority = 30
251 }
252
253 Job {
254   Name = "BackupCatalogHDD"
255   Type = Backup
256   Level = Full
257   Client = tosfeb33-fd
258   FileSet="Catalog"
259   Schedule = "Weekdays"
260   Storage = HDdrive
261   Messages = Standard
262   Pool = HDD
263   # This creates an ASCII copy of the catalog
264   RunBeforeJob = "/etc/bacula/make_catalog_backup -u bacula"
265   # This deletes the copy of the catalog
266   RunAfterJob  = "/etc/bacula/delete_catalog_backup"
267   Write Bootstrap = "/var/bacula/working/BackupCatalog.bsr"
268   Priority = 90                   # run after main backup
269 }
270
271 Job {
272   Name = "BackupCatalogUSB"
273   Type = Backup
274   Level = Full
275   Client = tosfeb33-fd
276   FileSet="Catalog"
277   Schedule = "WeeklyUSB"
278   Storage = USBdrive
279   Messages = Standard
280   Pool = USB
281   # This creates an ASCII copy of the catalog
282   RunBeforeJob = "/etc/bacula/make_catalog_backup -u bacula"
283   # This writes the volume file to the proper USB device
284   RunAfterJob  = "/etc/bacula/write_to_USB %v"
285 #  RunAfterJob  = "/etc/bacula/delete_catalog_backup"
286   Write Bootstrap = "/var/bacula/working/BackupCatalog.bsr"
287   Priority = 90                   # run after main backup
288 }
289
290 Job {
291   Name = "BackupCatalogDVD"
292   Type = Backup
293   Level = Full
294   Client = tosfeb33-fd
295   FileSet="Catalog"
296   Schedule = "MonthlyDVD"
297   Storage = DVDdrive
298   Messages = Standard
299   Pool = DVD
300   # This creates an ASCII copy of the catalog
301   RunBeforeJob = "/etc/bacula/make_catalog_backup -u bacula"
302   # This writes the volume file to a DVD
303   RunAfterJob = "/etc/bacula/write_to_DVD %v"
304   Write Bootstrap = "/var/bacula/working/BackupCatalog.bsr"
305   Priority = 90                   # run after main backup
306 }
307
308 # Standard Restore template, to be changed by Console program
309 Job {
310   Name = "RestoreFiles"
311   Type = Restore
312   Client = tosfeb33-fd
313   FileSet="Full Set"
314   Storage = HDdrive
315   Messages = Standard
316   Pool = HDD
317   Where = /tmp/bacula-restores
318 }
319
320 # List of files to be backed up
321 FileSet {
322   Name = "Full Set"
323   Include = signature=MD5 portable=yes {
324 #
325 #  Put your list of files here, one per line or include an
326 #    external list with:
327 #
328 #    <file-name
329 #
330 #  Note: / backs up everything on the root partition.
331 #    if you have other partitons such as /usr or /home
332 #    you will probably want to add them too.
333 #
334 #  By default this is defined to point to the Bacula build
335 #    directory to give a reasonable FileSet to backup to
336 #    disk storage during initial testing.
337 #
338     /tmp/bacula-1.32b
339   }
340
341 #
342 # If you backup the root directory, the following two excluded
343 #   files can be useful
344 #
345   Exclude = { /proc /tmp /.journal /.fsck }
346 }
347
348 #
349 # When to do the backups, full backup on first sunday of the month,
350 FileSet {
351   Name = "Tosfeb31All"
352   Include = signature=MD5 portable=yes {
353 # System of Tosfeb31
354     "C:/"
355 # Data1
356     "E:/"
357 # Program
358     "F:/"
359 # Finance
360     "G:/"
361 # Home
362     "H:/"
363   }
364   Exclude = {pagefile.sys, *.[Dd][Mm][Pp]}
365 }
366 FileSet {
367   Name = "Tosfeb31AllCompressed"
368   Include = signature=MD5 compression=GZIP portable=yes {
369 # System of Tosfeb31
370     "C:/"
371 # Data1
372     "E:/"
373 # Program
374     "F:/"
375 # Finance
376     "G:/"
377 # Home
378     "H:/"
379   }
380   Exclude = {pagefile.sys, *.[Dd][Mm][Pp]}
381 }
382 FileSet {
383   Name = "Tosfeb31Essential"
384   Include = signature=MD5  compression=GZIP portable=yes {
385 # Data1
386     "E:/"
387 # Finance
388     "G:/"
389   }
390   Exclude = {*.[Tt][Mm][Pp], *.backup.fm, *.backup.book}
391 }
392 FileSet {
393   Name = "Tosfeb32All"
394   Include = signature=MD5 portable=yes {
395 # System of Tosfeb32
396     "C:/"
397 # NotesData
398     "E:/"
399 # Lib
400     "H:/"
401   }
402   Exclude = {pagefile.sys, *.[Dd][Mm][Pp]}
403 }
404 FileSet {
405   Name = "Tosfeb32Essential"
406   Include = signature=MD5  compression=GZIP portable=yes {
407 # NotesData
408     "E:/"
409   }
410   Exclude = {*.[Tt][Mm][Pp]}
411 }
412
413 FileSet {
414   Name = "Tosfeb33System"
415   Include = signature=MD5 portable=yes {
416     "/bin"
417     "/boot"
418     "/etc"
419     "/home"
420     "/lib"
421     "/root"
422     "/sbin"
423     "/usr"
424   }
425   Exclude = {/var, /proc}
426 }
427
428 FileSet {
429   Name = "Tosfeb33Essential"
430   Include = signature=MD5 compression=GZIP portable=yes {
431     "/etc"
432     "/root"
433   }
434 }
435
436 Schedule {
437   Name = "Weekdays"
438   Run = Full tue-fri at 01:00
439 }
440
441 Schedule {
442   Name = "WeeklyUSB"
443   Run = Full sat at 01:00
444 }
445
446 Schedule {
447   Name = "MonthlyDVD"
448   Run = Full 1st sat at 04:00 # These will remain on site
449   Run = Full 3rd sat at 04:00 # These will be carried off site
450 }
451
452 # This is the backup of the catalog
453 FileSet {
454   Name = "Catalog"
455   Include = signature=MD5 {
456      /var/bacula/working/bacula.sql
457   }
458 }
459
460 # Client (File Services) to backup
461 Client {
462   Name = tosfeb33-fd
463   Address = tosfeb33.abis.be
464   FDPort = 9102
465   Catalog = MyCatalog
466   Password = "abis"          # password for FileDaemon
467   File Retention = 30 days            # 30 days
468   Job Retention = 6 months            # six months
469   AutoPrune = yes                     # Prune expired Jobs/Files
470 }
471
472 Client {
473   Name = tosfeb30-fd
474   Address = tosfeb30.abis.be
475   FDPort = 9102
476   Catalog = MyCatalog
477   Password = "abis"
478   File Retention = 30 days
479   Job Retention = 6 months
480   AutoPrune = yes
481 }
482
483 Client {
484   Name = tosfeb31-fd
485   Address = tosfeb31.abis.be
486   FDPort = 9102
487   Catalog = MyCatalog
488   Password = "abis"
489   File Retention = 30 days
490   Job Retention = 6 months
491   AutoPrune = yes
492 }
493
494 Client {
495   Name = tosfeb32-fd
496   Address = tosfeb32.abis.be
497   FDPort = 9102
498   Catalog = MyCatalog
499   Password = "abis"
500   File Retention = 30 days
501   Job Retention = 6 months
502   AutoPrune = yes
503 }
504
505 # Definiton of file storage device
506
507 Storage {
508   Name = HDdrive
509   Address = tosfeb33.abis.be
510   SDPort = 9103
511   Password = "abis"
512   Device = HDdriveStorage
513   Media Type = File
514 }
515
516 Storage {
517   Name = USBdrive
518   Address = tosfeb33.abis.be
519   SDPort = 9103
520   Password = "abis"
521   Device = USBdriveStorage
522   Media Type = File
523 }
524
525 Storage {
526   Name = DVDdrive
527   Address = tosfeb33.abis.be
528   SDPort = 9103
529   Password = "abis"
530   Device = DVDdriveStorage
531   Media Type = File
532 }
533
534 # Generic catalog service
535 Catalog {
536   Name = MyCatalog
537   dbname = bacula; user = bacula; password = ""
538 }
539
540 # Reasonable message delivery -- send most everything to email address
541 #  and to the console
542 Messages {
543   Name = Standard
544   mailcommand = "/usr/sbin/smtp -h tosfeb32.abis.be -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
545   operatorcommand = "/usr/sbin/smtp -h tosfeb32.abis.be -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
546   mail = jdecock@abis.be = all, !skipped
547   operator = jdecock@abis.be = mount
548   console = all, !skipped, !saved
549 #
550 # WARNING! the following will create a file that you must cycle from
551 #          time to time as it will grow indefinitely. However, it will
552 #          also keep all your messages if they scroll off the console.
553 #
554   append = "/etc/bacula/working/log" = all, !skipped
555 }
556
557 # Pool definition for daily backup on hard disk in backup server
558 Pool {
559   Name = HDD
560   Pool Type = Backup
561   Recycle = yes
562 #  Recycle Oldest Volume = yes
563   Purge Oldest Volume = yes
564   Autoprune = yes
565   Maximum Volumes = 4 # Monday through Thursday
566   Volume Retention = 2 weeks
567   Accept Any Volume = yes
568   Maximum Volume Jobs = 4 # 31, 32, 33 and Catalog
569 #  Maximum Volume Files = 2
570   Maximum Volume Bytes = 18g
571   Volume Use Duration = 1d
572   Label Format = "HDDVolume"
573 }
574
575 # Pool definition for weekly backup, first on hard disk,
576 #then to be copied on removable USB2 hard disk drives in an AfterRunJob
577 Pool {
578   Name = USB
579   Pool Type = Backup
580   Recycle = yes
581   Purge Oldest Volume = yes
582   Autoprune = yes
583   Maximum Volumes = 3 # We have 3 removable USB2 disks
584   Volume Retention = 2 months
585   Accept Any Volume = yes
586   Maximum Volume Jobs = 4 # 31, 32, 33 and Catalog
587   Maximum Volume Bytes = 18g
588   Volume Use Duration = 1d
589   Label Format = "USBVolume"
590 }
591
592 # Pool definition for monthly backups on DVDspool, to be copied to DVD+/-R media in an AfterRunJob
593 Pool {
594   Name = DVD
595   Pool Type = Backup
596   Recycle = no
597   Autoprune = no
598   Volume Retention = 2 years
599   Accept Any Volume = yes
600   Maximum Volume Bytes = 2147483500 # 2 GB is the maximum size of a file on an ISO9660 file system
601   Maximum Volume Jobs = 1 # each backup job gets its own set of volumes
602 #  Maximum Volume Bytes = 4699990000 # 4 700 000 000 # 4.38 GB is the actual size that will fit on a DVD
603   Volume Use Duration = 1d
604   Label Format = "DVD${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-${NumVols}"
605 }
606
607
608
609 prepare_DVDspool:
610
611
612
613 #!/bin/bash
614 #
615 # shell script to initialize environment for creating a backup that will be written to DVD+/-R(W)
616
617 # it will need to check whether there is enough space on the path supplied as the first parameter
618 # and if there isn't it will need to remove some files.
619
620 # it will also remove the file where all the volume names are collected during the backup run.
621
622 path=$1 # /mnt/backupdaily
623 quota=$2 # 4700000
624
625 #Define global variable to hold return value from function
626
627 freespace=
628
629 # Define function to determine free space on a mount point
630
631 FreeSpace () {
632      freespace=`df | grep $path | awk '{print $4}'`
633      if [ 0 -ne `expr index "$freespace" %` ] ; then
634           freespace=`df | grep $path | awk '{print $3}'`
635      fi
636      }
637 #Define global variable to hold return value from function
638
639 padded=
640
641 # Define function to pad a number with spaces to the left for display
642
643 PadSpacesToLeft () {
644      stringtopad=$1
645      wantedlength=$2
646
647      while [ ${#stringtopad} -lt $wantedlength ]
648      do
649           stringtopad=" "$stringtopad
650      done
651      padded=$stringtopad
652      }
653
654 PadSpacesToLeft $quota 9
655
656 echo "How much free space is needed on $path? $padded"
657
658 # How much space is there left?
659
660 FreeSpace
661
662 PadSpacesToLeft $freespace 9
663
664 echo "Free space currently available on $path:$padded"
665
666 # As long as there isn't enough room, delete the oldest DVD volume files
667 while [ $freespace -lt $quota ]
668 do
669      # determine which is the oldest DVD volume file in /mnt/backupdaily
670      # ls puts the oldest file on top
671      # head grabs the first line
672      # and awk gets the 9th column of this line, i.e. the file name we were looking for
673      oldestfile=`ls -ralt $path/DVD* | head -n 1 | awk '{print $9}'`
674
675      echo "Deleting: $oldestfile"
676      rm  -f $oldestfile
677
678      # assess how much space there is now
679      FreeSpace
680      PadSpacesToLeft $freespace 9
681      echo "Free space currently available on $path:$padded"
682      # and then we test again.
683 done
684
685 # remove the file where all the volume names will be  collected.
686 # so we can have a clean run
687
688 rm -f /var/bacula/volumes
689
690 exit 0
691
692
693 inventorize_volumes:
694
695 #!/bin/bash
696 #
697 # shell script to inventorize volumes used during a backup
698 volumes=$1
699
700 # Replace | character with spaces (necessary for the for command)
701
702 volumes=${volumes//|/ }
703
704 # For every volume do
705
706 for i in $volumes ; do
707      echo $i >> /var/bacula/volumes
708 done
709
710 exit 0
711
712
713
714 write_to_DVD:
715
716 #!/bin/bash
717 #
718 # shell script to copy DVD volume files from /mnt/backupdaily to DVD+/-R(W)
719
720 # The last volume was not added to the inventory list yet, so we do that first
721 /etc/bacula/inventorize_volumes $1
722
723 supermount -m=/mnt/cdrom disable
724
725 umount /mnt/cdrom
726
727 # another shell script run as a RunAfterJob has been putting the volume names into a text file
728 # now we retrieve those names and write them to DVD
729
730 # this awk command produces a space delimited list of the lines of the text file and assigns it to $lines
731
732 lines=`awk '{print $1}' /var/bacula/volumes`
733
734 # now we can iterate over those volume names
735
736 let "count=1"
737 for i in $lines ; do
738      if [ $count -le 1 ] ; then
739           # When creating a DVD with growisofs one needs to use -Z the first time
740           echo "Writing first volume file" $count
741           growisofs -Z /dev/scd0 -R -J /mnt/backupdaily/$i
742      else
743           # and -M the for the next volume files
744           echo "Writing another volume file" $count
745           growisofs -M /dev/scd0 -R -J /mnt/backupdaily/$i
746      fi
747      let count="$count+1"
748 #    sleep 5
749      ls -al /mnt/cdrom
750 #    sleep 5
751 done
752
753 ls -al /mnt/backupdaily
754 mount /mnt/cdrom
755 ls -al /mnt/cdrom
756 umount /mnt/cdrom
757
758 #supermount -m=/mnt/cdrom enable
759
760 # This is run as a RunAfterJob of the catalog backup. It already had a RunAfterJob, so we execute that here
761 /etc/bacula/delete_catalog_backup
762
763 exit 0
764
765
766
767
768 This last one is to write to removable USB-storage.
769
770 write_to_USB
771
772 #!/bin/bash
773 #
774 # shell script to finalize USB backup
775
776 volumename=$1
777 echo "   Creating mount points, if they don't exist"
778 if ! [ -d /mnt/usbdrv ] ; then
779   mkdir /mnt/usbdrv
780 fi
781 if ! [ -d /mnt/usbdrv/bacula ] ; then
782   mkdir /mnt/usbdrv/bacula
783 fi
784 if ! [ -d /mnt/usbdrv/misc ] ; then
785   mkdir /mnt/usbdrv/misc
786 fi
787  #unmount all mount points related to USB
788
789 echo "   Making sure no USB devices are mounted"
790 umount /mnt/usbdrv
791 umount /mnt/usbdrv/bacula
792 umount /mnt/usbdrv/misc
793 umount /mnt/removable
794 umount /mnt/removable2
795 umount /mnt/removable3
796
797  #determine which /dev/sd? contains the right USBVolume for this backup
798
799 echo "   Determining whether the right USB device containing our USBVolume is present physically"
800
801 found=nothing
802 for i in sda sdb sdc; do
803   sd=$i"1"
804   echo "   Trying with $sd"
805   mount /dev/$sd /mnt/usbdrv/bacula -t ext2
806   ls -al /mnt/usbdrv/bacula
807
808   if [ -f /mnt/usbdrv/bacula/$volumename ] ; then
809     found=/dev/$i
810   fi
811
812   umount /mnt/usbdrv/bacula
813 done
814
815 echo
816 echo "    Found: $found containing $volumename "
817 echo
818 if [ $found != nothing ] ; then
819    # mount /mnt/usbdrv/bacula and /mnt/usbdrv/misc on /dev/sd?1 and /dev/sd?5 respectively
820   mount $found"1" /mnt/usbdrv/bacula -t ext2
821   mount $found"5" /mnt/usbdrv/misc -t vfat
822
823    # copy Ghost images of Windows system drives, the contents of /etc/bacula/*
824    # and a text file with restore instructions to /mnt/usbdrv/misc
825
826   echo "   Copying Ghost image of TOSFEB31 to /mnt/usbdrv/misc"
827   cp -v /mnt/Ghost/PROD/TOSFEB31/SYSTEMAG.GHO /mnt/usbdrv/misc
828   echo "   Copying Ghost image of TOSFEB32 to /mnt/usbdrv/misc"
829   cp -v /mnt/Ghost/PROD/TOSFEB32/COFTF32.GHO /mnt/usbdrv/misc
830   echo "   Copying /etc/bacula to /mnt/usbdrv/misc"
831   cp -Rfv /etc/bacula/ /mnt/usbdrv/misc
832   echo "   Copying Restore instructions to /mnt/usbdrv/misc"
833   cp -v /etc/bacula/How_To_Restore.txt /mnt/usbdrv/misc
834
835    # copy the current USBVolume to /mnt/usbdrv/bacula overwriting the previous volume file
836   echo
837   echo "   Copying Bacula USB-volume to /mnt/usbdrv/bacula"
838
839 #  cp -fv /mnt/spool/$volumename /mnt/usbdrv/bacula
840
841    # give some feedback about what was done
842
843   echo
844   echo "   Directory contents of /mnt/usbdrv/bacula"
845   ls -al /mnt/usbdrv/bacula
846   echo
847   echo "   Directory contents of /mnt/usbdrv/misc"
848   ls -al /mnt/usbdrv/misc
849
850    # unmount /mnt/usbdrv/bacula and /mnt/usbdrv/misc
851   echo
852   echo "   Unmounting /mnt/usbdrv/... mount points"
853   umount /mnt/usbdrv/bacula
854   umount /mnt/usbdrv/misc
855
856 else
857    # send emails if correct medium is not present
858 #  /usr/sbin/smtp
859   echo "hello"
860 fi
861
862 # This is run as a RunAfterJob of the catalog backup. It already had a RunAfterJob, so we execute that here
863 /etc/bacula/delete_catalog_backup
864
865
866
867
868
869
870 From: "Alex Federau" <alex.federau@gmx.ch> on 30/01/2004 15:57 GMT
871
872 To:   Johan Decock/Abis@Abis
873 cc:
874 Subject:  Re: [Bacula-users] cdwriter
875
876
877
878 --0__=dQlRuu8umGKzn67woQcbAbtp1kVJLJuYIqUZPSjcX1GgjEHuWdvHDqOX
879 Content-type: text/plain; charset=iso-8859-1
880 Content-Disposition: inline
881 Content-Transfer-Encoding: 8bit
882
883
884 Hi Johan,
885 Could you send me the scripts or tell me where they are located. I am
886 browsing the mail archive,
887 and while I can find several of your mails, I am unable to find your
888 scripts. Probably they would be very useful for us.
889
890 Cheers
891 Alex
892
893
894 >
895 >
896 > Hi Alex,
897 >
898 > Bacula isn't able to write to CD-R or DVD+/-R directly. This isn't needed
899 > though. If you look in the mailing list archive, you will find that I have
900 > implemented a solution where the backup volume files are written to DVD+R
901 > with some bash scripts. A caveat is that files on an ISO9660 can't be
902 larger
903 > than 2 GB (Not on Linux anyway). This has kept me busy for a while,
904 > looking what was going on and why I wasn't able to read back my DVD's.
905 >
906 > I hope my scripts are of help to you.
907 >
908 > Johan
909 >
910 >
911 >
912 >
913 > From: "Alex Federau" <alex.federau@gmx.ch> on 30/01/2004 14:29 GMT
914 >
915 > To:   bacula-users@lists.sourceforge.net
916 > cc:    (bcc: Johan Decock/Abis)
917 > Subject:  [Bacula-users] cdwriter
918 >
919 >
920 >
921
922 --
923 +++ Mailpower für Multimedia-Begeisterte: http://www.gmx.net/topmail +++
924 250 MB Mailbox, 1 GB Online-Festplatte, 100 FreeSMS. Jetzt kostenlos testen!
925
926
927
928
929
930
931
932
933 --------------------------------------------------------------------------
934 ABIS Training & Consulting
935 website: http://www.abis.be   -   e-mail: training@abis.be
936 tel: Belgium: (+32)-16-245610   -   The Netherlands: (+31)-348-435570
937 fax: Belgium: (+32)-16-245691   -   The Netherlands: (+31)-348-432493
938 --------------------------------------------------------------------------
939 --0__=dQlRuu8umGKzn67woQcbAbtp1kVJLJuYIqUZPSjcX1GgjEHuWdvHDqOX--
940
941
942
943 -------------------------------------------------------
944 The SF.Net email is sponsored by EclipseCon 2004
945 Premiere Conference on Open Tools Development and Integration
946 See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
947 http://www.eclipsecon.org/osdn
948 _______________________________________________
949 Bacula-users mailing list
950 Bacula-users@lists.sourceforge.net
951 https://lists.sourceforge.net/lists/listinfo/bacula-users