From bd2e33a9d1617eeabaffc821ffe442b058890cdd Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Tue, 11 Aug 2020 15:06:58 -0400 Subject: [PATCH] No clue --- Dir Config/bacula-barcodes | 51 +++ Dir Config/bacula-dir.conf | 19 +- Dir Config/bacula-dir.conf.backup | 324 +++++++++++++++++++ Dir Config/bacula-fd.conf.backup | 49 +++ Dir Config/bacula-sd.conf | 38 +++ Dir Config/bacula-sd.conf.backup | 335 +++++++++++++++++++ Dir Config/clients/director-client.conf | 4 + Dir Config/clients/zinc-client-other.conf | 15 + Dir Config/clients/zinc-client-system.conf | 6 +- Dir Config/clients/zinc-client-users.conf | 70 ++-- Dir Config/clients/zinc-client.conf | 33 +- Dir Config/common_default_passwords | 12 + Dir Config/filesets.conf | 100 ++++++ Dir Config/filesets/filesets-users.conf | 28 +- Dir Config/schedules.conf | 4 +- Dir Config/scripts/release_tape.sh | 3 + bacula-sd.conf | 76 +++++ mtx-changer | 353 +++++++++++++++++++++ 18 files changed, 1453 insertions(+), 67 deletions(-) create mode 100644 Dir Config/bacula-barcodes create mode 100644 Dir Config/bacula-dir.conf.backup create mode 100644 Dir Config/bacula-fd.conf.backup create mode 100644 Dir Config/bacula-sd.conf create mode 100644 Dir Config/bacula-sd.conf.backup create mode 100644 Dir Config/clients/zinc-client-other.conf create mode 100644 Dir Config/common_default_passwords create mode 100644 Dir Config/filesets.conf create mode 100644 bacula-sd.conf create mode 100644 mtx-changer diff --git a/Dir Config/bacula-barcodes b/Dir Config/bacula-barcodes new file mode 100644 index 0000000..0a0b2dc --- /dev/null +++ b/Dir Config/bacula-barcodes @@ -0,0 +1,51 @@ +# +# Bacula barcode simulation file +# used by ${PREFIX}/sbin/chio-bacula (FreeBSD) +# +# The volumenames are returned by the "changer list" command +# labeling in the console is done by "label barcodes" +# (then all volumes belog to the default pool). +# All Lines with an "#" at the bedinning are ignored +# +# !!!! If you export an tape and reinsert another one, +# !!!! don't forget to change the volume name in this file! +# +1:Volume1-100 +2:Volume1-101 +3:Volume1-102 +4:Volume1-103 +5:Volume1-104 +6:Volume1-105 +7:Volume1-106 +8:Volume1-107 +9:Volume1-108 +10:Volume1-109 +11:Volume1-110 +12:Volume1-111 +# +# Further volumes exported from the changer +# +# 36GB AIT2 tapes +#Volume1-100 +#Volume1-101 +#Volume1-102 +#Volume1-103 +#Volume1-104 +#Volume1-105 +#Volume1-106 +#Volume1-107 +#Volume1-108 +#Volume1-109 +#Volume1-110 +#Volume1-111 +#Volume1-112 +#Volume1-113 +#Volume1-114 +#Volume1-115 +# +# 50GB AIT2 tapes +#Volume2-200 +#Volume2-201 +#Volume2-202 +#Volume2-203 +#Volume2-204 diff --git a/Dir Config/bacula-dir.conf b/Dir Config/bacula-dir.conf index 7992424..d333c62 100644 --- a/Dir Config/bacula-dir.conf +++ b/Dir Config/bacula-dir.conf @@ -14,7 +14,7 @@ Director { # define myself QueryFile = "/etc/bacula/scripts/query.sql" WorkingDirectory = "/var/lib/bacula" PidDirectory = "/run/bacula" - Maximum Concurrent Jobs = 20 + Maximum Concurrent Jobs = 10 Password = "iamnotacrook" # Console password Messages = JoesMail DirAddress = 10.85.3.30 @@ -35,7 +35,7 @@ Autochanger { # New resource Password = "iamnotacrook" Device = Drive-0-LTO-3 Media Type = LTO-3 - Maximum Concurrent Jobs = 20 + Maximum Concurrent Jobs = 2 } Storage { # Can have multiple of these per autochanger @@ -45,7 +45,7 @@ Storage { # Can have multiple of these per autochanger Password = "iamnotacrook" Device = LTO-3 Media Type = LTO-3 - Maximum Concurrent Jobs = 10 + Maximum Concurrent Jobs = 1 Autochanger = Iron-Autochanger # New directive } @@ -81,6 +81,7 @@ messages { # Send mail just to me name = JoesMail mail = kenwood364@gmail.com = all, !skipped console = all, !skipped, !saved + catalog = all } messages { # Send mail to me and dad @@ -88,35 +89,47 @@ messages { # Send mail to me and dad #mail = mws03@comcast.net,kenwood364@gmail.com = all, !skipped mail = kenwood364@gmail.com = all, !skipped console = all, !skipped, !saved + catalog = all } messages { # Send mail to me and michael name = MikesMail mail = mikesedutto@gmail.com,kenwood364@gmail.com = all, !skipped console = all, !skipped, !saved + catalog = all } messages { # Send mail to me and matthew name = MattsMail mail = younglad204@gmail.com,kenwood364@gmail.com = all, !skipped console = all, !skipped, !saved + catalog = all } messages { # Send mail to me and Travis name = TravissMail mail = travisbuttons14@gmail.com,kenwood364@gmail.com = all, !skipped console = all, !skipped, !saved + catalog = all } messages { # Send mail to me and Zach name = ZachsMail mail = zmcmenemy@gmail.com,kenwood364@gmail.com = all, !skipped console = all, !skipped, !saved + catalog = all } messages { # Send mail to me and Caleb name = CalebsMail mail = younglad204@gmail.com,kenwood364@gmail.com = all, !skipped console = all, !skipped, !saved + catalog = all } +messages { # Send mail to me and Chris + name = ChrisMail + mail = chrispdo1373@gmail.com,kenwood364@gmail.com = all, !skipped + console = all, !skipped, !saved + catalog = all +} diff --git a/Dir Config/bacula-dir.conf.backup b/Dir Config/bacula-dir.conf.backup new file mode 100644 index 0000000..1b95dfb --- /dev/null +++ b/Dir Config/bacula-dir.conf.backup @@ -0,0 +1,324 @@ +# +# Default Bacula Director Configuration file +# +# The only thing that MUST be changed is to add one or more +# file or directory names in the Include directive of the +# FileSet resource. +# +# For Bacula release 9.4.2 (04 February 2019) -- ubuntu 20.04 +# +# You might also want to change the default email address +# from root to your address. See the "mail" and "operator" +# directives in the Messages resource. +# +# Copyright (C) 2000-2017 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# + +Director { # define myself + Name = bacula-dir + DIRport = 9101 # where we listen for UA connections + QueryFile = "/etc/bacula/scripts/query.sql" + WorkingDirectory = "/var/lib/bacula" + PidDirectory = "/run/bacula" + Maximum Concurrent Jobs = 20 + Password = "p2ee6NtCH6Y-mw3bVk5yGgo1wjXnyne4a" # Console password + Messages = Daemon + DirAddress = 127.0.0.1 +} + +JobDefs { + Name = "DefaultJob" + Type = Backup + Level = Incremental + Client = bacula-fd + FileSet = "Full Set" + Schedule = "WeeklyCycle" + Storage = File1 + Messages = Standard + Pool = File + SpoolAttributes = yes + Priority = 10 + Write Bootstrap = "/var/lib/bacula/%c.bsr" +} + + +# +# Define the main nightly save backup job +# By default, this job will back up to disk in /nonexistant/path/to/file/archive/dir +Job { + Name = "BackupClient1" + JobDefs = "DefaultJob" +} + +#Job { +# Name = "BackupClient2" +# Client = bacula2-fd +# JobDefs = "DefaultJob" +#} + +#Job { +# Name = "BackupClient1-to-Tape" +# JobDefs = "DefaultJob" +# Storage = LTO-4 +# Spool Data = yes # Avoid shoe-shine +# Pool = Default +#} + +#} + +# Backup the catalog database (after the nightly save) +Job { + Name = "BackupCatalog" + JobDefs = "DefaultJob" + Level = Full + FileSet="Catalog" + Schedule = "WeeklyCycleAfterBackup" + # This creates an ASCII copy of the catalog + # Arguments to make_catalog_backup.pl are: + # make_catalog_backup.pl + RunBeforeJob = "/etc/bacula/scripts/make_catalog_backup.pl MyCatalog" + # This deletes the copy of the catalog + RunAfterJob = "/etc/bacula/scripts/delete_catalog_backup" + Write Bootstrap = "/var/lib/bacula/%n.bsr" + Priority = 11 # run after main backup +} + +# +# Standard Restore template, to be changed by Console program +# Only one such job is needed for all Jobs/Clients/Storage ... +# +Job { + Name = "RestoreFiles" + Type = Restore + Client=bacula-fd + Storage = File1 +# The FileSet and Pool directives are not used by Restore Jobs +# but must not be removed + FileSet="Full Set" + Pool = File + Messages = Standard + Where = /nonexistant/path/to/file/archive/dir/bacula-restores +} + + +# List of files to be backed up +FileSet { + Name = "Full Set" + Include { + Options { + signature = MD5 + } +# +# Put your list of files here, preceded by 'File =', one per line +# or include an external list with: +# +# File = \" -s \"Bacula: %t %e of %c %l\" %r" + operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r" + mail = root = all, !skipped + operator = root = mount + console = all, !skipped, !saved +# +# WARNING! the following will create a file that you must cycle from +# time to time as it will grow indefinitely. However, it will +# also keep all your messages if they scroll off the console. +# + append = "/var/log/bacula/bacula.log" = all, !skipped + catalog = all +} + + +# +# Message delivery for daemon messages (no job). +Messages { + Name = Daemon + mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r" + mail = root = all, !skipped + console = all, !skipped, !saved + append = "/var/log/bacula/bacula.log" = all, !skipped +} + +# Default pool definition +Pool { + Name = Default + Pool Type = Backup + Recycle = yes # Bacula can automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 365 days # one year + Maximum Volume Bytes = 50G # Limit Volume size to something reasonable + Maximum Volumes = 100 # Limit number of Volumes in Pool +} + +# File Pool definition +Pool { + Name = File + Pool Type = Backup + Recycle = yes # Bacula can automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 365 days # one year + Maximum Volume Bytes = 50G # Limit Volume size to something reasonable + Maximum Volumes = 100 # Limit number of Volumes in Pool + Label Format = "Vol-" # Auto label +} + + +# Scratch pool definition +Pool { + Name = Scratch + Pool Type = Backup +} + +# +# Restricted console used by tray-monitor to get the status of the director +# +Console { + Name = bacula-mon + Password = "qh2ITlwo3xfTzP8uxwJjq1vJshc1Dsimc" + CommandACL = status, .status +} diff --git a/Dir Config/bacula-fd.conf.backup b/Dir Config/bacula-fd.conf.backup new file mode 100644 index 0000000..d417044 --- /dev/null +++ b/Dir Config/bacula-fd.conf.backup @@ -0,0 +1,49 @@ +# +# Default Bacula File Daemon Configuration file +# +# For Bacula release 9.4.2 (04 February 2019) -- ubuntu 20.04 +# +# There is not much to change here except perhaps the +# File daemon Name to +# +# +# Copyright (C) 2000-2015 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# + +# +# List Directors who are permitted to contact this File daemon +# +Director { + Name = bacula-dir + Password = "plfcG_XSfD6EBSD0YQhZThlZNHFFFjqtg" +} + +# +# Restricted Director, used by tray-monitor to get the +# status of the file daemon +# +Director { + Name = bacula-mon + Password = "ULdl26830u9xQw1i8YI_VBqaIMG1OfE_V" + Monitor = yes +} + +# +# "Global" File daemon configuration specifications +# +FileDaemon { # this is me + Name = bacula-fd + FDport = 9102 # where we listen for the director + WorkingDirectory = /var/lib/bacula + Pid Directory = /run/bacula + Maximum Concurrent Jobs = 20 + Plugin Directory = /usr/lib/bacula + FDAddress = 127.0.0.1 +} + +# Send all messages except skipped files back to Director +Messages { + Name = Standard + director = bacula-dir = all, !skipped, !restored +} diff --git a/Dir Config/bacula-sd.conf b/Dir Config/bacula-sd.conf new file mode 100644 index 0000000..94786e1 --- /dev/null +++ b/Dir Config/bacula-sd.conf @@ -0,0 +1,38 @@ +Storage { # definition of myself + Name = test-bacula-sd # Name of this device + SDPort = 9103 # Director's port + WorkingDirectory = "/var/lib/bacula" # Working Directory + Pid Directory = "/run/bacula" # PID Directory + Plugin Directory = "/usr/lib/bacula" # Directory for plugins + Maximum Concurrent Jobs = 20 # Max jobs it can do at any one time + SDAddress = 127.0.0.1 # Address of the SD +} + +Director { # Director who is allowed to contact us + Name = bacula-dir # Name of the director + Password = "iamnotacrook" # Password for the director to usr to login +} + +#Autochanger { # Virtual Auto Changer +# Name = FileChgr1 # Has a name +# Device = FileChgr1-Dev1 # Seperate tape drives with commas +# Changer Command = "" # Not sure what this is for +# Changer Device = /dev/null # Device is not real +#} + +#Device { # Device for Autochanger +# Name = FileChgr1-Dev1 # Has a name +# Media Type = File1 # has a type of media +# Archive Device = /backup/tape # Archive location(?) not sure on this one +# LabelMedia = yes; # lets Bacula label unlabeled media +# Random Access = Yes; # Not sure what this is for +# AutomaticMount = yes; # when device opened, read it +# RemovableMedia = no; # Not sure what this is for +# AlwaysOpen = no; # Not sure what this is for +# Maximum Concurrent Jobs = 5 # Can do 5 jobs at once? (not sure how but ok) +#} + +Messages { # Place to send messages + Name = Standard # Send standard messag es + director = bacula-dir = all # Forward those to the director +} \ No newline at end of file diff --git a/Dir Config/bacula-sd.conf.backup b/Dir Config/bacula-sd.conf.backup new file mode 100644 index 0000000..1e4f95e --- /dev/null +++ b/Dir Config/bacula-sd.conf.backup @@ -0,0 +1,335 @@ +# +# Default Bacula Storage Daemon Configuration file +# +# For Bacula release 9.4.2 (04 February 2019) -- ubuntu 20.04 +# +# You may need to change the name of your tape drive +# on the "Archive Device" directive in the Device +# resource. If you change the Name and/or the +# "Media Type" in the Device resource, please ensure +# that dird.conf has corresponding changes. +# +# +# Copyright (C) 2000-2017 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# + +Storage { # definition of myself + Name = bacula-sd + SDPort = 9103 # Director's port + WorkingDirectory = "/var/lib/bacula" + Pid Directory = "/run/bacula" + Plugin Directory = "/usr/lib/bacula" + Maximum Concurrent Jobs = 20 + SDAddress = 127.0.0.1 +} + +# +# List Directors who are permitted to contact Storage daemon +# +Director { + Name = bacula-dir + Password = "wyHyTtf3Q5Mul8VvNNtm9D2lsIg2mKBVh" +} + +# +# Restricted Director, used by tray-monitor to get the +# status of the storage daemon +# +Director { + Name = bacula-mon + Password = "F988Q4o09gBCTwOO3hvk-DKGMtd-xKLo7" + Monitor = yes +} + +# +# Note, for a list of additional Device templates please +# see the directory /examples/devices +# Or follow the following link: +# http://www.bacula.org/git/cgit.cgi/bacula/tree/bacula/examples/devices?h=Branch-7.4 +# + +# +# Devices supported by this Storage daemon +# To connect, the Director's bacula-dir.conf must have the +# same Name and MediaType. +# + +# +# Define a Virtual autochanger +# +Autochanger { + Name = FileChgr1 + Device = FileChgr1-Dev1, FileChgr1-Dev2 + Changer Command = "" + Changer Device = /dev/null +} + +Device { + Name = FileChgr1-Dev1 + Media Type = File1 + Archive Device = /nonexistant/path/to/file/archive/dir + LabelMedia = yes; # lets Bacula label unlabeled media + Random Access = Yes; + AutomaticMount = yes; # when device opened, read it + RemovableMedia = no; + AlwaysOpen = no; + Maximum Concurrent Jobs = 5 +} + +Device { + Name = FileChgr1-Dev2 + Media Type = File1 + Archive Device = /nonexistant/path/to/file/archive/dir + LabelMedia = yes; # lets Bacula label unlabeled media + Random Access = Yes; + AutomaticMount = yes; # when device opened, read it + RemovableMedia = no; + AlwaysOpen = no; + Maximum Concurrent Jobs = 5 +} + +# +# Define a second Virtual autochanger +# +Autochanger { + Name = FileChgr2 + Device = FileChgr2-Dev1, FileChgr2-Dev2 + Changer Command = "" + Changer Device = /dev/null +} + +Device { + Name = FileChgr2-Dev1 + Media Type = File2 + Archive Device = /nonexistant/path/to/file/archive/dir + LabelMedia = yes; # lets Bacula label unlabeled media + Random Access = Yes; + AutomaticMount = yes; # when device opened, read it + RemovableMedia = no; + AlwaysOpen = no; + Maximum Concurrent Jobs = 5 +} + +Device { + Name = FileChgr2-Dev2 + Media Type = File2 + Archive Device = /nonexistant/path/to/file/archive/dir + LabelMedia = yes; # lets Bacula label unlabeled media + Random Access = Yes; + AutomaticMount = yes; # when device opened, read it + RemovableMedia = no; + AlwaysOpen = no; + Maximum Concurrent Jobs = 5 +} + + + +# +# An autochanger device with two drives +# +#Autochanger { +# Name = Autochanger +# Device = Drive-1 +# Device = Drive-2 +# Changer Command = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d" +# Changer Device = /dev/sg0 +#} + +#Device { +# Name = Drive-1 # +# Drive Index = 0 +# Media Type = DLT-8000 +# Archive Device = /dev/nst0 +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes; +# RemovableMedia = yes; +# RandomAccess = no; +# AutoChanger = yes +# # +# # New alert command in Bacula 9.0.0 +# # Note: you must have the sg3_utils (rpms) or the +# # sg3-utils (deb) installed on your system. +# # and you must set the correct control device that +# # corresponds to the Archive Device +# Control Device = /dev/sg?? # must be SCSI ctl for /dev/nst0 +# Alert Command = "/etc/bacula/scripts/tapealert %l" +# +# # +# # Enable the Alert command only if you have the mtx package loaded +# # Note, apparently on some systems, tapeinfo resets the SCSI controller +# # thus if you turn this on, make sure it does not reset your SCSI +# # controller. I have never had any problems, and smartctl does +# # not seem to cause such problems. +# # +# Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" +#} + +#Device { +# Name = Drive-2 # +# Drive Index = 1 +# Media Type = DLT-8000 +# Archive Device = /dev/nst1 +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes; +# RemovableMedia = yes; +# RandomAccess = no; +# AutoChanger = yes +# # Enable the Alert command only if you have the mtx package loaded +# Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" +#} + +# +# A Linux or Solaris LTO-2 tape drive +# +#Device { +# Name = LTO-2 +# Media Type = LTO-2 +# Archive Device = /dev/nst0 +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes; +# RemovableMedia = yes; +# RandomAccess = no; +# Maximum File Size = 3GB +## Changer Command = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d" +## Changer Device = /dev/sg0 +## AutoChanger = yes +# # Enable the Alert command only if you have the mtx package loaded +## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +## If you have smartctl, enable this, it has more info than tapeinfo +## Alert Command = "sh -c 'smartctl -H -l error %c'" +#} + +# +# A Linux or Solaris LTO-3 tape drive +# +#Device { +# Name = LTO-3 +# Media Type = LTO-3 +# Archive Device = /dev/nst0 +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes; +# RemovableMedia = yes; +# RandomAccess = no; +# Maximum File Size = 4GB +# Changer Command = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d" +# Changer Device = /dev/sg0 +# AutoChanger = yes +# # +# # New alert command in Bacula 9.0.0 +# # Note: you must have the sg3_utils (rpms) or the +# # sg3-utils (deb) installed on your system. +# # and you must set the correct control device that +# # corresponds to the Archive Device +# Control Device = /dev/sg?? # must be SCSI ctl for /dev/nst0 +# Alert Command = "/etc/bacula/scripts/tapealert %l" +# +# # Enable the Alert command only if you have the mtx package loaded +## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +## If you have smartctl, enable this, it has more info than tapeinfo +## Alert Command = "sh -c 'smartctl -H -l error %c'" +#} + +# +# A Linux or Solaris LTO-4 tape drive +# +#Device { +# Name = LTO-4 +# Media Type = LTO-4 +# Archive Device = /dev/nst0 +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes; +# RemovableMedia = yes; +# RandomAccess = no; +# Maximum File Size = 5GB +# Changer Command = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d" +# Changer Device = /dev/sg0 +# AutoChanger = yes +# # +# # New alert command in Bacula 9.0.0 +# # Note: you must have the sg3_utils (rpms) or the +# # sg3-utils (deb) installed on your system. +# # and you must set the correct control device that +# # corresponds to the Archive Device +# Control Device = /dev/sg?? # must be SCSI ctl for /dev/nst0 +# Alert Command = "/etc/bacula/scripts/tapealert %l" +# +# # Enable the Alert command only if you have the mtx package loaded +## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +## If you have smartctl, enable this, it has more info than tapeinfo +## Alert Command = "sh -c 'smartctl -H -l error %c'" +#} + +# +# An HP-UX tape drive +# +#Device { +# Name = Drive-1 # +# Drive Index = 0 +# Media Type = DLT-8000 +# Archive Device = /dev/rmt/1mnb +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes; +# RemovableMedia = yes; +# RandomAccess = no; +# AutoChanger = no +# Two EOF = yes +# Hardware End of Medium = no +# Fast Forward Space File = no +# # +# # New alert command in Bacula 9.0.0 +# # Note: you must have the sg3_utils (rpms) or the +# # sg3-utils (deb) installed on your system. +# # and you must set the correct control device that +# # corresponds to the Archive Device +# Control Device = /dev/sg?? # must be SCSI ctl for /dev/rmt/1mnb +# Alert Command = "/etc/bacula/scripts/tapealert %l" +# +# # +# # Enable the Alert command only if you have the mtx package loaded +# Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" +#} + +# +# A FreeBSD tape drive +# +#Device { +# Name = DDS-4 +# Description = "DDS-4 for FreeBSD" +# Media Type = DDS-4 +# Archive Device = /dev/nsa1 +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes +# Offline On Unmount = no +# Hardware End of Medium = no +# BSF at EOM = yes +# Backward Space Record = no +# Fast Forward Space File = no +# TWO EOF = yes +# # +# # New alert command in Bacula 9.0.0 +# # Note: you must have the sg3_utils (rpms) or the +# # sg3-utils (deb) installed on your system. +# # and you must set the correct control device that +# # corresponds to the Archive Device +# Control Device = /dev/sg?? # must be SCSI ctl for /dev/nsa1 +# Alert Command = "/etc/bacula/scripts/tapealert %l" +# +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" +#} + +# +# Send all messages to the Director, +# mount messages also are sent to the email address +# +Messages { + Name = Standard + director = bacula-dir = all +} diff --git a/Dir Config/clients/director-client.conf b/Dir Config/clients/director-client.conf index 0aea7fb..205cd6c 100644 --- a/Dir Config/clients/director-client.conf +++ b/Dir Config/clients/director-client.conf @@ -32,6 +32,10 @@ Job { Storage = Iron-Autochanger Schedule = EveryTwoDays Messages = JoesMail + + Reschedule Interval = 12 hours + Reschedule On Error = yes + Reschedule Times = 3 Pool = Full-Pool # required parameter for all Jobs, despite what appears in the next few lines diff --git a/Dir Config/clients/zinc-client-other.conf b/Dir Config/clients/zinc-client-other.conf new file mode 100644 index 0000000..5436d8d --- /dev/null +++ b/Dir Config/clients/zinc-client-other.conf @@ -0,0 +1,15 @@ +# These are jobs run for vms, storage, archive, etc + +Job { # Archive Obelisk + Name = "Archive-Obelisk" + Client = Zinc-Client + Type = "Backup" + FileSet = "Obelisk Archive" + Storage = Iron-Autochanger + Messages = JoesMail + + Pool = Archive-Pool # required parameter for all Jobs, despite what appears in the next few lines + + Full Backup Pool = Archive-Pool + Incremental Backup Pool = Archive-Pool +} \ No newline at end of file diff --git a/Dir Config/clients/zinc-client-system.conf b/Dir Config/clients/zinc-client-system.conf index 1718972..591e9b4 100644 --- a/Dir Config/clients/zinc-client-system.conf +++ b/Dir Config/clients/zinc-client-system.conf @@ -6,8 +6,12 @@ Job { # Backup Proxmox VZdumps Type = "Backup" FileSet = "Proxmox Backups" Storage = Iron-Autochanger - #Schedule = EveryTwoDays + Schedule = EveryTwoDays Messages = JoesMail + + Reschedule Interval = 12 hours + Reschedule On Error = yes + Reschedule Times = 3 Pool = Full-Pool # required parameter for all Jobs, despite what appears in the next few lines diff --git a/Dir Config/clients/zinc-client-users.conf b/Dir Config/clients/zinc-client-users.conf index dea9743..887c7d8 100644 --- a/Dir Config/clients/zinc-client-users.conf +++ b/Dir Config/clients/zinc-client-users.conf @@ -2,80 +2,46 @@ Job { # Caleb's Job Name = "Backup-Caleb" - Client = Zinc-Client - Type = "Backup" + JobDefs = "Default-User-Job" FileSet = "Caleb Backup" - Storage = Iron-Autochanger - #Schedule = EveryTwoDays - Messages = JoesMail - - Pool = Full-Pool # required parameter for all Jobs, despite what appears in the next few lines - - Full Backup Pool = Full-Pool - Differential Backup Pool = Diff-Pool - Incremental Backup Pool = Incr-Pool } Job { # Mark's Job Name = "Backup-Mark" - Client = Zinc-Client - Type = "Backup" FileSet = "Mark Backup" - Storage = Iron-Autochanger - Schedule = EveryTwoDays + JobDefs = "Default-User-Job" Messages = MarksMail - - Pool = Full-Pool # required parameter for all Jobs, despite what appears in the next few lines - - Full Backup Pool = Full-Pool - Differential Backup Pool = Diff-Pool - Incremental Backup Pool = Incr-Pool } Job { # My Job Name = "Backup-Joe" - Client = Zinc-Client - Type = "Backup" + JobDefs = "Default-User-Job" FileSet = "Joe Backup" - Storage = Iron-Autochanger - Schedule = EveryTwoDays - Messages = JoesMail - - Pool = Full-Pool # required parameter for all Jobs, despite what appears in the next few lines - - Full Backup Pool = Full-Pool - Differential Backup Pool = Diff-Pool - Incremental Backup Pool = Incr-Pool } Job { # Backup Michael Name = "Backup-Michael" - Client = Zinc-Client - Type = "Backup" + JobDefs = "Default-User-Job" FileSet = "Michael Backup" - Storage = Iron-Autochanger - Schedule = EveryTwoDays Messages = MikesMail - - Pool = Full-Pool # required parameter for all Jobs, despite what appears in the next few lines - - Full Backup Pool = Full-Pool - Differential Backup Pool = Diff-Pool - Incremental Backup Pool = Incr-Pool } Job { # Backup Matthew Name = "Backup-Matthew" - Client = Zinc-Client - Type = "Backup" + JobDefs = "Default-User-Job" FileSet = "Matthew Backup" - Storage = Iron-Autochanger - Schedule = EveryTwoDays Messages = MattsMail - - Pool = Full-Pool # required parameter for all Jobs, despite what appears in the next few lines - - Full Backup Pool = Full-Pool - Differential Backup Pool = Diff-Pool - Incremental Backup Pool = Incr-Pool } + +Job { # Backup Chris + Name = "Backup-Chris" + JobDefs = "Default-User-Job" + FileSet = "Chris Backup" + Messages = ChrisMail +} + +Job { # Backup Evelynn + Name = "Backup-Evelynn" + JobDefs = "Default-User-Job" + FileSet = "Evelynn Backup" +} \ No newline at end of file diff --git a/Dir Config/clients/zinc-client.conf b/Dir Config/clients/zinc-client.conf index 0d307ed..bbb614e 100644 --- a/Dir Config/clients/zinc-client.conf +++ b/Dir Config/clients/zinc-client.conf @@ -3,12 +3,31 @@ @/etc/bacula/clients/zinc-client-archive.conf Client { - Name = Zinc-Client - Password = "iamnotacrook" - Address = 10.85.3.31 - Catalog = MyCatalog - File Retention = 4 months - Job Retention = 30 years - AutoPrune = yes # Prune expired Jobs/Files + Name = Zinc-Client # Clients name + Password = "iamnotacrook" # The password that client uses? + Address = 10.85.3.31 # The address of the client jail + Catalog = MyCatalog # Specify the catalog + File Retention = 8 months # This is how long you'll be able to restore individual files for, per job + Job Retention = 30 years # Archive jobs cant be pruned for 30 years + AutoPrune = yes # Prune expired Jobs/Files } +JobDefs { # Default Job + Name = "Default-User-Job" + Client = Zinc-Client + Type = "Backup" + FileSet = "Catalog" + Storage = Iron-Autochanger + Schedule = EveryTwoDays + Messages = JoesMail + + Reschedule Interval = 12 hours + Reschedule On Error = yes + Reschedule Times = 3 + + Pool = Full-Pool # required parameter for all Jobs, despite what appears in the next few lines + + Full Backup Pool = Full-Pool + Differential Backup Pool = Diff-Pool + Incremental Backup Pool = Incr-Pool +} diff --git a/Dir Config/common_default_passwords b/Dir Config/common_default_passwords new file mode 100644 index 0000000..00b0a24 --- /dev/null +++ b/Dir Config/common_default_passwords @@ -0,0 +1,12 @@ +# +# This file has been autogenerated during package installation and +# holds defaults for new Bacula packages installed on this system. It +# is used only when you install a new Bacula package, and can be +# safely removed at any time. + +DIRPASSWD=p2ee6NtCH6Y-mw3bVk5yGgo1wjXnyne4a +DIRMPASSWD=qh2ITlwo3xfTzP8uxwJjq1vJshc1Dsimc +SDPASSWD=wyHyTtf3Q5Mul8VvNNtm9D2lsIg2mKBVh +SDMPASSWD=F988Q4o09gBCTwOO3hvk-DKGMtd-xKLo7 +FDPASSWD=plfcG_XSfD6EBSD0YQhZThlZNHFFFjqtg +FDMPASSWD=ULdl26830u9xQw1i8YI_VBqaIMG1OfE_V diff --git a/Dir Config/filesets.conf b/Dir Config/filesets.conf new file mode 100644 index 0000000..27fd90e --- /dev/null +++ b/Dir Config/filesets.conf @@ -0,0 +1,100 @@ +# Bacula config Backup +FileSet { + Name = "MyFirstFileSet" + Include { + Options { + signature=MD5 + } + File = /etc/bacula/ + } + Exclude { + File = *~ + } +} + +# This is the backup of the catalog +FileSet { + Name = "Catalog" + Include { + Options { + signature = MD5 + } + File = "/var/lib/postgresql/12/main" + } +} + +# Caleb's backup on zinc +FileSet { + Name = "Caleb Backup" + Include { + Options { + signature = MD5 + compression=GZIP + } + File = "/mnt/Caleb/" + } +} + +# Mark's backup on zinc +FileSet { + Name = "Mark Backup" + Include { + Options { + signature = MD5 + compression=GZIP + } + File = "/mnt/Mark/" + #File = "/mnt/NextCloud/data/mark/" + } +} + +# Joe's backup on zinc +FileSet { + Name = "Joe Backup" + Include { + Options { + signature = MD5 + compression=GZIP + } + File = "/mnt/Joe/" + File = "/mnt/NextCloud/data/joe/" + } +} + +# Matthew's backup on zinc +FileSet { + Name = "Matthew Backup" + Include { + Options { + signature = MD5 + compression=GZIP + } + File = "/mnt/Matthew/" + #File = "/mnt/NextCloud/data/matthew/" + } +} + +# Michael's backup on zinc +FileSet { + Name = "Michael Backup" + Include { + Options { + signature = MD5 + compression=GZIP + } + File = "/mnt/Michael/" + #File = "/mnt/NextCloud/data/michael/" + } +} + +# Archive for Obelisk +FileSet { + Name = "Obelisk Archive" + Include { + Options { + signature = MD5 + compression=GZIP + } + File = "/mnt/Obelisk/" + } +} \ No newline at end of file diff --git a/Dir Config/filesets/filesets-users.conf b/Dir Config/filesets/filesets-users.conf index 21e9c96..a8f3c55 100644 --- a/Dir Config/filesets/filesets-users.conf +++ b/Dir Config/filesets/filesets-users.conf @@ -72,7 +72,7 @@ FileSet { compression=GZIP } File = "/mnt/Users/Matthew/" - #File = "/mnt/NextCloud/data/matthew/" + File = "/mnt/NextCloud/data/matthew/" } } @@ -85,6 +85,30 @@ FileSet { compression=GZIP } File = "/mnt/Users/Michael/" - #File = "/mnt/NextCloud/data/michael/" + File = "/mnt/NextCloud/data/michael/" } } + +# Chris's backup on zinc +FileSet { + Name = "Chris Backup" + Include { + Options { + signature = MD5 + compression=GZIP + } + File = "/mnt/NextCloud/data/chris/" + } +} + +# Evelynn's backup on zinc +FileSet { + Name = "Evelynn Backup" + Include { + Options { + signature = MD5 + compression=GZIP + } + File = "/mnt/NextCloud/data/evelynn/" + } +} \ No newline at end of file diff --git a/Dir Config/schedules.conf b/Dir Config/schedules.conf index 1eba563..bd074f8 100644 --- a/Dir Config/schedules.conf +++ b/Dir Config/schedules.conf @@ -3,7 +3,7 @@ Schedule { Run = Level=Full jan apr jul oct 1st sun at 2:15 # Run a full backup once every four months Run = Level=Differential feb mar may jun aug sep nov dec 1st sun at 2:15 # Run a differential backup every other month - Run = Level=Incremental sat tue at 2:15 # Run an incremental backup on tuesdays and saturdays + Run = Level=Incremental tue at 2:15 # Run an incremental backup on tuesdays and saturdays #Run = Level=Differential mar 1st sun at 2:15 #Run = Level=Full apr 1st sun at 2:15 @@ -25,7 +25,7 @@ Schedule { Run = Level=Full jan apr jul oct 1st sun at 2:30 Run = Level=Differential feb mar may jun aug sep nov dec 1st sun at 2:30 - Run = Level=Incremental sat tue at 2:30 + Run = Level=Incremental tue at 2:30 #Run = Level=Full jan 1st sun at 2:30 #Run = Level=Differential feb 1st sun at 2:30 diff --git a/Dir Config/scripts/release_tape.sh b/Dir Config/scripts/release_tape.sh index 85f81f6..0bedb7d 100644 --- a/Dir Config/scripts/release_tape.sh +++ b/Dir Config/scripts/release_tape.sh @@ -3,3 +3,6 @@ # This will inject "release" into bconsole echo release storage=Iron-Autochanger slot=0 | bconsole + +# Release slot 1 too +echo release storage=Iron-Autochanger slot=1 | bconsole diff --git a/bacula-sd.conf b/bacula-sd.conf new file mode 100644 index 0000000..190a459 --- /dev/null +++ b/bacula-sd.conf @@ -0,0 +1,76 @@ +Storage { # definition of myself + Name = bacula-iron-sd + SDPort = 9103 # Director's port + WorkingDirectory = "/var/db/bacula" + Pid Directory = "/var/run" + Plugin Directory = "/usr/local/lib" + Maximum Concurrent Jobs = 20 + SDAddress = 10.85.3.31 +} + +Director { # Director who is allowed to contact us + Name = bacula-dir + Password = "iamnotacrook" +} + +Autochanger { + Name = "Iron-Autochanger" + Device = Drive-0-LTO-3 + Changer Device = /dev/pass1 + Changer Command = "/usr/local/sbin/mtx-changer %c %o %S %a %d" +} + +Device { + Name = Drive-0-LTO-3 + Media Type = LTO-3 + Archive Device = /dev/nsa0 + AutomaticMount = yes; # when device opened, read it + AlwaysOpen = yes; + RemovableMedia = yes; + RandomAccess = no; + Maximum File Size = 4GB + #Changer Command = "/opt/bacula/scripts/mtx-changer %c %o %S %a %d" + Changer Command = "/usr/local/sbin/mtx-changer %c %o %S %a %d" + Changer Device = /dev/pass1 + AutoChanger = yes + # Enable the Alert command only if you have the mtx package loaded + Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" + # If you have smartctl, enable this, it has more info than tapeinfo + # Alert Command = "sh -c 'smartctl -H -l error %c'" +} + + +# +# A Linux or Solaris LTO-3 tape drive +# +#Device { +# Name = LTO-3 +# Media Type = LTO-3 +# Archive Device = /dev/nst0 +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes; +# RemovableMedia = yes; +# RandomAccess = no; +# Maximum File Size = 4GB +# Changer Command = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d" +# Changer Device = /dev/sg0 +# AutoChanger = yes +# # +# # New alert command in Bacula 9.0.0 +# # Note: you must have the sg3_utils (rpms) or the +# # sg3-utils (deb) installed on your system. +# # and you must set the correct control device that +# # corresponds to the Archive Device +# Control Device = /dev/sg?? # must be SCSI ctl for /dev/nst0 +# Alert Command = "/etc/bacula/scripts/tapealert %l" +# +# # Enable the Alert command only if you have the mtx package loaded +## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +## If you have smartctl, enable this, it has more info than tapeinfo +## Alert Command = "sh -c 'smartctl -H -l error %c'" +#} + +Messages { + Name = Standard + director = bacula-dir = all +} diff --git a/mtx-changer b/mtx-changer new file mode 100644 index 0000000..d6fdd28 --- /dev/null +++ b/mtx-changer @@ -0,0 +1,353 @@ +#!/bin/sh +# +# Bacula(R) - The Network Backup Solution +# +# Copyright (C) 2000-2016 Kern Sibbald +# +# The original author of Bacula is Kern Sibbald, with contributions +# from many others, a complete list can be found in the file AUTHORS. +# +# You may use this file and others of this release according to the +# license defined in the LICENSE file, which includes the Affero General +# Public License, v3.0 ("AGPLv3") and some additional permissions and +# terms pursuant to its AGPLv3 Section 7. +# +# This notice must be preserved when any source code is +# conveyed and/or propagated. +# +# Bacula(R) is a registered trademark of Kern Sibbald. +# +# If you set in your Device resource +# +# Changer Command = "path-to-this-script/mtx-changer %c %o %S %a %d" +# you will have the following input to this script: +# +# So Bacula will always call with all the following arguments, even though +# in come cases, not all are used. +# +# mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index" +# $1 $2 $3 $4 $5 +# +# for example: +# +# mtx-changer /dev/sg0 load 1 /dev/nst0 0 (on a Linux system) +# +# will request to load the first cartidge into drive 0, where +# the SCSI control channel is /dev/sg0, and the read/write device +# is /dev/nst0. +# +# The commands are: +# Command Function +# unload unload a given slot +# load load a given slot +# loaded which slot is loaded? +# list list Volume names (requires barcode reader) +# slots how many slots total? +# listall list all info +# transfer +# +# Slots are numbered from 1 ... +# Drives are numbered from 0 ... +# +# +# If you need to an offline, refer to the drive as $4 +# e.g. mt -f $4 offline +# +# Many changers need an offline after the unload. Also many +# changers need a sleep 60 after the mtx load. +# +# N.B. If you change the script, take care to return either +# the mtx exit code or a 0. If the script exits with a non-zero +# exit code, Bacula will assume the request failed. +# + +# myversion must be the same as version in mtx-changer.conf +myversion=2 + +# source our conf file +if test ! -f /usr/local/share/bacula/mtx-changer.conf ; then + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "ERROR: /usr/local/share/bacula/mtx-changer.conf file not found!!!!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + exit 1 +fi +. /usr/local/share/bacula/mtx-changer.conf + +if test "${version}" != "${myversion}" ; then + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "ERROR: /usr/local/share/bacula/mtx-changer.conf has wrong version. Wanted ${myversion}, got ${version} !!!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + exit 1 +fi + +MTX=mtx + +if test ${debug_log} -ne 0 ; then + touch /var/db/bacula/mtx.log +fi +dbgfile="/var/db/bacula/mtx.log" +debug() { + if test -f $dbgfile -a ${debug_level} -ge $1; then + echo "`date +%m%d-%H:%M:%S.%N|cut -c1-16` ${chgr_id} $2" >> $dbgfile + fi +} + + +# +# Create a temporary file +# +make_temp_file() { + TMPFILE=`mktemp /var/db/bacula/mtx.XXXXXXXXXX` + if test x${TMPFILE} = x; then + TMPFILE="/var/db/bacula/mtx.$$" + if test -f ${TMPFILE}; then + echo "ERROR: Temp file security problem on: ${TMPFILE}" + exit 1 + fi + fi +} + +# +# Create a temporary file for stderr +# +# Note, this file is used because sometime mtx emits +# unexpected error messages followed by the output +# expected during success. +# So we separate STDOUT and STDERR in +# certain of the mtx commands. The contents of STDERR +# is then printed after the STDOUT produced by mtx +# thus we sometimes get better changer results. +# +make_err_file() { + ERRFILE=`mktemp /var/db/bacula/mtx.err.XXXXXXXXXX` + if test x${ERRFILE} = x; then + ERRFILE="/var/db/bacula/mtx.err.$$" + if test -f ${ERRFILE}; then + echo "ERROR: Temp file security problem on: ${ERRFILE}" + exit 1 + fi + fi +} + + +# +# The purpose of this function to wait a maximum +# time for the drive. It will +# return as soon as the drive is ready, or after +# waiting a maximum of 300 seconds. +# Note, this is very system dependent, so if you are +# not running on Linux, you will probably need to +# re-write it, or at least change the grep target. +# We've attempted to get the appropriate OS grep targets +# in the code at the top of this script. +# +wait_for_drive() { + i=0 + while [ $i -le 300 ]; do # Wait max 300 seconds + if mt -f $1 status 2>&1 | grep "${ready}" >/dev/null 2>&1; then + break + fi + debug $dbglvl "Device $1 - not ready, retrying..." + sleep 1 + i=`expr $i + 1` + done +} + +# check parameter count on commandline +# +check_parm_count() { + pCount=$1 + pCountNeed=$2 + if test $pCount -lt $pCountNeed; then + echo "ERROR: usage: mtx-changer ctl-device command [slot archive-device drive-index]" + echo " Insufficient number of arguments given." + if test $pCount -lt 2; then + echo " Mimimum usage is first two arguments ..." + else + echo " Command expected $pCountNeed arguments" + fi + exit 1 + fi +} + +# Check for special cases where only 2 arguments are needed, +# all others are a minimum of 5 +# +case $2 in + list|listall) + check_parm_count $# 2 + ;; + slots) + check_parm_count $# 2 + ;; + transfer) + check_parm_count $# 4 + ;; + *) + check_parm_count $# 5 + ;; +esac + + +# Setup arguments +ctl=$1 +cmd="$2" +slot=$3 +device=$4 +drive=$5 + +debug $dbglvl "Parms: $ctl $cmd $slot $device $drive" + +case $cmd in + unload) + + if test ${offline} -eq 1 ; then + mt -f $device offline + fi + if test ${offline_sleep} -ne 0 ; then + sleep ${offline_sleep} + fi + make_err_file + for i in 1 2 3 4 5 ; do + debug $idbglvl "Doing mtx -f $ctl unload slot=$slot drv=$drive" + ${MTX} -f $ctl unload $slot $drive 2>${ERRFILE} + rtn=$? + if test $rtn -eq 0 ; then + break + fi + grep "Error Code=" ${ERRFILE} 2>/dev/null 1>/dev/null + if test $? -ne 0 ; then + break + fi + sleep $i + done + cat ${ERRFILE} + rm -f ${ERRFILE} >/dev/null 2>&1 + if test $rtn -ne 0 ; then + debug $idbglvl "FAIL: mtx -f $ctl unload slot=$slot drv=$drive" + fi + exit $rtn + ;; + + load) + make_err_file + for i in 1 2 3 4 5 ; do + debug $idbglvl "Doing mtx -f $ctl load slot=$slot drv=$drive" + ${MTX} -f $ctl load $slot $drive 2>${ERRFILE} + rtn=$? + if test $rtn -eq 0 ; then + break + fi + grep "Error Code=" ${ERRFILE} 2>/dev/null 1>/dev/null + if test $? -ne 0 ; then + break + fi + sleep $i + done + if test ${load_sleep} -ne 0 ; then + sleep ${load_sleep} + fi + wait_for_drive $device + cat ${ERRFILE} + rm -f ${ERRFILE} >/dev/null 2>&1 + if test $rtn -ne 0 ; then + debug $idbglvl "FAIL: mtx -f $ctl load slot=$slot drv=$drive" + fi + exit $rtn + ;; + + list) + make_temp_file + if test ${inventory} -ne 0 ; then + ${MTX} -f $ctl inventory + fi + debug $dbglvl "Doing mtx -f $ctl list" + ${MTX} -f $ctl status >${TMPFILE} + rtn=$? + if test ${vxa_packetloader} -ne 0 ; then + cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" | sed "s/ Storage Element //" | sed "s/Full :VolumeTag=//" + else + cat ${TMPFILE} | grep " Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//" + fi + cat ${TMPFILE} | grep "^Data Transfer Element [0-9]*:Full (Storage Element [0-9]" | awk '{printf "%s:%s\n",$7,$10}' + rm -f ${TMPFILE} >/dev/null 2>&1 + if test $rtn -ne 0 ; then + debug $idbglvl "FAIL: mtx -f $ctl list" + fi + exit $rtn + ;; + + listall) +# Drive content: D:Drive num:F:Slot loaded:Volume Name +# D:0:F:2:vol2 or D:Drive num:E +# D:1:F:42:vol42 +# D:3:E +# +# Slot content: +# S:1:F:vol1 S:Slot num:F:Volume Name +# S:2:E or S:Slot num:E +# S:3:F:vol4 +# +# Import/Export tray slots: +# I:10:F:vol10 I:Slot num:F:Volume Name +# I:11:E or I:Slot num:E +# I:12:F:vol40 + + make_temp_file + if test ${inventory} -ne 0 ; then + ${MTX} -f $ctl inventory + fi + debug $dbglvl "Doing mtx -f $ctl -- to list all" + ${MTX} -f $ctl status >${TMPFILE} + rtn=$? + # can be converted to awk+sed+cut, see below + perl -ne ' +/Data Transfer Element (\d+):Empty/ && print "D:$1:E\n"; +/Data Transfer Element (\d+):Full \(Storage Element (\d+) Loaded\)(:VolumeTag =\s*(.+))?/ && print "D:$1:F:$2:$4\n"; +/Storage Element (\d+):Empty/ && print "S:$1:E\n"; +/Storage Element (\d+):Full( :VolumeTag=(.+))?/ && print "S:$1:F:$3\n"; +/Storage Element (\d+) IMPORT.EXPORT:Empty/ && print "I:$1:E\n"; +/Storage Element (\d+) IMPORT.EXPORT:Full( :VolumeTag=(.+))?/ && print "I:$1:F:$3\n";' ${TMPFILE} + # If perl isn't installed, you can use by those commands +#cat ${TMPFILE} | grep "Data Transfer Element" | awk "{print \"D:\"\$4 \$7 \$9 \$10}" | sed "s/=/:/" | sed "s/Full/F:/" | sed "s/Empty/E/" +#cat ${TMPFILE} | grep -v "Data Transfer Element" | grep "Storage Element" | grep -v "IMPORT/EXPORT" | awk "{print \"S:\"\$3 \$4 \$5}" | sed "s/IMPORT\/EXPORT//" | sed "s/Full *:VolumeTag=/F:/" | sed "s/Empty/E/" +#cat ${TMPFILE} | grep -v "Data Transfer Element" | grep "Storage Element" | grep "IMPORT/EXPORT" | awk "{print \"I:\"\$3 \$4 \$5}" | sed "s/IMPORT\/EXPORT//" | sed "s/Full *:VolumeTag=/F:/" | sed "s/Empty/E/" + + rm -f ${TMPFILE} >/dev/null 2>&1 + exit $rtn + ;; + + transfer) + slotdest=$device + debug $dbglvl "Doing transfer from $slot to $slotdest" + ${MTX} -f $ctl transfer $slot $slotdest + rtn=$? + if test $rtn -ne 0 ; then + debug $idbglvl "FAIL: mtx -f $ctl transfer from=$slot to=$slotdest" + fi + exit $rtn + ;; + + loaded) + make_temp_file + debug $idbglvl "Doing mtx -f $ctl $drive -- to find what is loaded" + ${MTX} -f $ctl status >${TMPFILE} + rtn=$? + cat ${TMPFILE} | grep "^Data Transfer Element $drive:Full" | awk "{print \$7}" + cat ${TMPFILE} | grep "^Data Transfer Element $drive:Empty" | awk "{print 0}" + rm -f ${TMPFILE} >/dev/null 2>&1 + if test $rtn -ne 0 ; then + debug $idbglvl "FAIL: mtx -f $ctl loaded drv=$drive" + fi + exit $rtn + ;; + + slots) + debug $dbglvl "Doing mtx -f $ctl -- to get count of slots" + ${MTX} -f $ctl status | grep " *Storage Changer" | awk "{print \$5}" + rtn=$? + if test $rtn -ne 0 ; then + debug $idbglvl "FAIL: mtx -f $ctl slots" + fi + ;; +esac