From: Kern Sibbald Date: Tue, 19 Apr 2005 22:00:54 +0000 (+0000) Subject: Add more contributed examples X-Git-Tag: Release-1.38.0~551 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5c70fa3571c70830bf6b8cb41a0e5b30c5650fb3;p=bacula%2Fbacula Add more contributed examples git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1943 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/examples/autochangers/multiple-drive-changer.txt b/bacula/examples/autochangers/multiple-drive-changer.txt new file mode 100644 index 0000000000..4d2ceca83a --- /dev/null +++ b/bacula/examples/autochangers/multiple-drive-changer.txt @@ -0,0 +1,258 @@ +Date: Tue, 15 Feb 2005 17:36:06 +0100 +From: Mario Wolff +To: kern@sibbald.com +CC: bacula-devel +Subject: Re: Using multiple tapedrives as autochanger! + +Hi Kern! + +Kern Sibbald schrieb: + > Hello, + > + > There is a similar script named ak-mtx-changer.txt in the + > /examples/autochangers directory of the source tree. If you feel + > that your script brings something different, then I'll be happy to + > include it in the same directory. If that is the case, please put a + > small note in an email message to me with the script and I'll include it + > (I know you've already sent the script, but it saves me the time of + > searching for it, and I'm sure I've got the right one). + > + > Best regards, Kern + +As far as i understood the ak-mtx-changer.txt it's simply a +human-resource-changer!?! +In the past every single server had it's own DDS-3 Tape, since we switch + to a centralized networkbackup all these drives are unused. +Now i took 6 of these drives and placed it in large case on one +scsi-controller. Running bacula with multitape-changer these six drives +are used as one drive with a 6-Slot-Changer! + +Regards, +Mario + +PS: I've posted a deploy-script (deploy windows-fd from linux, automated + your hints) a few days ago over gmane to the devellist. This message +was never posted and i got no error message. Maybe problem with the size +(Windows-FD was attached!) ??? + +[pasted the hints once again for Kern!] + +Example: +bacula-dir.conf: + +# Definition of DDS tape storage device +Storage { + Name = Multitape + #Do not use "localhost" here + Address = mystorage # N.B. Use a fully qualified name here + SDPort = 9103 + Password = "strongsecret" # password for Storage daemon + Device = Multitape + Autochanger = yes + Media Type = DDS-3 +} + +bacula-sd.conf: +Device { + Name = Multitape # + Media Type = DDS-3 + Archive Device = /dev/tape + AutomaticMount = yes; # when device opened, read it + AlwaysOpen = yes; + RemovableMedia = yes; + RandomAccess = no; + # That's the magic!!! + Changer Command = "/etc/bacula/scripts/multitape-changer %c %o %S %a %d" + Changer Device = /dev/null + AutoChanger = yes +} + +Hints: +- Important to use a virtual name! multidrive-changer will create links! + (Archive Device = /dev/tape) +- It's a bash script not a sh script! +- SD must run as root or the multitape-changer must be called with sudo +to have write permission to the /dev dir! +- the default-config does an umount on tape-change! Don't switch this! +SD has to release the device-file! +- don't use your tapedrives directly anymore! SD does not know that +/dev/tape is /dev/nst0! +- don't remove the sleep 1 after getslot...! Without the sleep you will +get a "Operation not permitted" error! +- only tested with Debian/GNU-Linux-SID + +[end of paste] + + +--------------050209030507060501040304 +Content-Type: text/plain; + name="multitape-changer" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline; + filename="multitape-changer" + +#!/bin/bash +# +# Bacula interface to use multiple drives as one tape-changer +# Arguments are copied from the mtx-script! Simply exchange +# the scriptname from demo-config +# +# If you set in your Device resource +# +# Changer Command = "path-to-this-script/multitape-changer" %c %o %S %a %d +# you will have the following input to this script: +# +# multitape-changer "changer-device" "command" "slot" "archive-device" "drive-index" +# $1 $2 $3 $4 $5 +# +# for example: +# +# multitape-changer /dev/sg0 load 1 /dev/nst0 0 (on a Linux system) +# +# Setup arguments +cmd="$2" +slot=$3 +DEVICE=${4:-/dev/tape} + +LABELDIR=/etc/bacula/tapelabel # where to find labelfiles +NULLDEVICE=/dev/null # if unmount link to this +SLOT01=/dev/nst0 # first slot +SLOT02=/dev/nst1 # second slot + # simply append more + +#get device for a given slotnumber +getdevice(){ + myslot=${1:-1} + if [ ${#myslot} -gt 2 ];then exit 1;fi + if [ ${#myslot} -eq 2 ];then + eval echo \$SLOT$myslot + return + else + eval echo \$SLOT0$myslot + return + fi +} + +#get name of labelfile for a given slot +getname(){ + myslot=${1:-1} + if [ ${#myslot} -gt 2 ];then exit 2;fi + if [ ${#myslot} -eq 2 ];then + echo SLOT$myslot + return + else + echo SLOT0$myslot + return + fi +} + +#how many tapes/slots to manage +getslots(){ + count=1 + while [ "$( getdevice $count )" ];do + count=$[ $count + 1 ] + done + echo $[ $count - 1 ] + return +} + +#get slot for a given device-file +getslot(){ + device=${1:-$NULLDEVICE} + if [ "$device" = "$NULLDEVICE" ];then + echo -en "0\n" + return + else + count=1 + slotdev=$( getdevice $count ) + while [ "$slotdev" ]; do + if [ "$slotdev" = "$device" ];then + echo -en "$count\n" + return + fi + count=$[ $count + 1 ] + slotdev=$( getdevice $count ) + done + exit 3 + fi +} + +if test $# -lt 2 ; then + echo "usage: multitape-changer ctl-device command slot archive-device drive" + echo " Insufficient number of arguments arguments given." + echo " Mimimum usage is first two arguments ..." + exit 4 +fi + +# +# Check for special cases where only 2 arguments are needed, +# all others are a minimum of 3 +case $cmd in + loaded) + ;; + unload) + ;; + list) + ;; + slots) + ;; + *) + if test $# -lt 3; then + echo "usage: multitape-changer ctl-device command slot archive-device drive" + echo " Insufficient number of arguments arguments given." + echo " Mimimum usage is first three arguments ..." + exit 5 + fi + ;; +esac + + +case $cmd in + unload) + if [ -e $DEVICE ];then + rm $DEVICE && ln -s $NULLDEVICE $DEVICE || exit 6 + else + ln -s $NULLDEVICE $DEVICE || exit 7 + fi + ;; + + load) + CURDEV=$( getdevice $slot ) + if [ -e $DEVICE ];then + rm $DEVICE && ln -s $CURDEV $DEVICE || exit 8 + else + ln -s $CURDEV $DEVICE || exit 9 + fi + ;; + + list) + slots=$( getslots ) + for slot in $( seq 1 $slots );do + labelfile=$LABELDIR/$( getname $slot ) + if [ -f "$labelfile" ];then + echo "$slot:$( head -n 1 $labelfile)" + else + echo "$slot:" + fi + done + exit 0 + ;; + + loaded) + if [ -e $DEVICE ];then + line=$( ls -la $DEVICE ) + fi + line=${line:-$NULLDEVICE} + getslot ${line##* } + sleep 1 + exit 0 + ;; + + slots) + getslots + exit 0 + ;; +esac + +--------------050209030507060501040304-- + diff --git a/bacula/examples/vm/bacula.data b/bacula/examples/vm/bacula.data new file mode 100644 index 0000000000..a316f7ee9a --- /dev/null +++ b/bacula/examples/vm/bacula.data @@ -0,0 +1,2 @@ +Bacula Data Tape + diff --git a/bacula/examples/vm/blabela.exec b/bacula/examples/vm/blabela.exec new file mode 100644 index 0000000000..5ffa6d4795 --- /dev/null +++ b/bacula/examples/vm/blabela.exec @@ -0,0 +1,83 @@ +/* REXX ****************************************************/ +/* BLABELA EXEC -- Example VM procedure for labeling tapes */ +/* to be used with Bacula in ANSI label */ +/* mode. */ +/* */ +/* Author: David Boyes */ +/* */ +/* Prereq: Tape drive attached at virtual addr */ +/* 181 (TAP1). */ +/* */ +/* Blank tape inserted in drive. */ +/* */ +/* External file BACULA DATA (used as a */ +/* dummy input file for MOVEFILE, since */ +/* MOVEFILE insists on having a real file */ +/* for input if we want actual output */ +/* by the CMS OS sim routines). */ +/* */ +/* Usage: BLABELA volumeid ownerid */ +/* */ +/* where: */ +/* */ +/* volumeid = ANSI volume id to be */ +/* written in VOL1 label and made */ +/* visible to the library automation */ +/* and other OSes. */ +/* */ +/* ownerid = local userid to "own" the */ +/* tape from the TMS viewpoint. Used */ +/* to validate mount requests and for */ +/* TMS housekeeping purposes. */ +/* */ +/* Maintenance Log: */ +/* */ +/* 16 Feb 2005 -- DB: Created procedure and released to */ +/* Bacula development list. */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/***********************************************************/ + +/***********************************************************/ +/* Parse command line arguments */ +/***********************************************************/ + +arg volser owner + +/***********************************************************/ +/* Rewind tape and write ANSI VOL1 label and logical EOT */ +/***********************************************************/ + +'TAPE REW (TAP1' +'TAPE WVOL1' volser owner '( TAP1 AL' +'TAPE WTM 2' + +/***********************************************************/ +/* Rewind tape and write Bacula ANSI label signature file */ +/* (HDR1 file containing BACULA.DATA FID as 1st file on */ +/* tape). Note that for some reason the LABELDEF command */ +/* requires FIDs longer than 8 chars to be passed via the */ +/* program stack, even if it would not cause the resulting */ +/* command to exceed the 255 char maximum. This is (IMHO) */ +/* an APARable bug, but c'est la vie. */ +/***********************************************************/ + +'TAPE REW ( TAP1' +'SET CMSTYPE HT' /* supress output to hide prompt for FID */ +'FILEDEF INMOVE DISK BACULA DATA A' +'FILEDEF OUTMOVE TAP1 AL ( RECFM F LRECL 80' +queue "BACULA.DATA" +'LABELDEF OUTMOVE FID ? VOLID' volser 'VOLSEQ 1 FSEQ 1' +'MOVEFILE' +'SET CMSTYPE RT' /* resume normal console output */ + +/***********************************************************/ +/* Print nice exit message and exit */ +/***********************************************************/ + +say "Labeled ANSI" volser "for use with Bacula." +exit diff --git a/bacula/examples/vm/blabeli.exec b/bacula/examples/vm/blabeli.exec new file mode 100644 index 0000000000..16d678e71b --- /dev/null +++ b/bacula/examples/vm/blabeli.exec @@ -0,0 +1,83 @@ +/* REXX ****************************************************/ +/* BLABELI EXEC -- Example VM procedure for labeling tapes */ +/* to be used with Bacula in IBM SL label */ +/* mode. */ +/* */ +/* Author: David Boyes */ +/* */ +/* Prereq: Tape drive attached at virtual addr */ +/* 181 (TAP1). */ +/* */ +/* Blank tape inserted in drive. */ +/* */ +/* External file BACULA DATA (used as a */ +/* dummy input file for MOVEFILE, since */ +/* MOVEFILE insists on having a real file */ +/* for input if we want actual output */ +/* by the CMS OS sim routines). */ +/* */ +/* Usage: BLABELI volumeid ownerid */ +/* */ +/* where: */ +/* */ +/* volumeid = IBM SL volume id to be */ +/* written in VOL1 label and made */ +/* visible to the library automation */ +/* and other OSes. */ +/* */ +/* ownerid = local userid to "own" the */ +/* tape from the TMS viewpoint. Used */ +/* to validate mount requests and for */ +/* TMS housekeeping purposes. */ +/* */ +/* Maintenance Log: */ +/* */ +/* 16 Feb 2005 -- DB: Created procedure and released to */ +/* Bacula development list. */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/***********************************************************/ + +/***********************************************************/ +/* Parse command line arguments */ +/***********************************************************/ + +arg volser owner + +/***********************************************************/ +/* Rewind tape and write IBM VOL1 label and logical EOT */ +/***********************************************************/ + +'TAPE REW (TAP1' +'TAPE WVOL1' volser owner '( TAP1 SL' +'TAPE WTM 2' + +/***********************************************************/ +/* Rewind tape and write Bacula IBM label signature file */ +/* (HDR1 file containing BACULA.DATA FID as 1st file on */ +/* tape). Note that for some reason the LABELDEF command */ +/* requires FIDs longer than 8 chars to be passed via the */ +/* program stack, even if it would not cause the resulting */ +/* command to exceed the 255 char maximum. This is (IMHO) */ +/* an APARable bug, but c'est la vie. */ +/***********************************************************/ + +'TAPE REW ( TAP1' +'SET CMSTYPE HT' /* supress output to hide prompt for FID */ +'FILEDEF INMOVE DISK BACULA DATA A' +'FILEDEF OUTMOVE TAP1 SL ( RECFM F LRECL 80' +queue "BACULA.DATA" +'LABELDEF OUTMOVE FID ? VOLID' volser 'VOLSEQ 1 FSEQ 1' +'MOVEFILE' +'SET CMSTYPE RT' /* resume normal console output */ + +/***********************************************************/ +/* Print nice exit message and exit */ +/***********************************************************/ + +say "Labeled IBM SL" volser "for use with Bacula." +exit diff --git a/bacula/examples/vm/tape-label-tools.txt b/bacula/examples/vm/tape-label-tools.txt new file mode 100644 index 0000000000..5ef734074a --- /dev/null +++ b/bacula/examples/vm/tape-label-tools.txt @@ -0,0 +1,27 @@ +From: David Boyes +To: "'kern@sibbald.com'" , +Cc: "'bacula-devel'" +Subject: RE: [Bacula-devel] ANSI label tape creation tools for VM +Date: Thu, 17 Feb 2005 11:03:26 -0500 + +I don't seem to have a way to update the CVS (nor really a lot of +experience with *update* access to the beastie), so appended below are +some example scripts to use on a z/VM system to create labeled tapes +suitable for use with the ANSI label support in Bacula. I suggest that +we put these in the "examples" section of the tree as contributed tools +-- I'll leave it to your discretion as to where/how to tag these. + +I'm finishing up the documentation and packaging for my z/VM tape mount +helper daemon and mtx-changer variant, so you may want to think about +where those should go as well. + +File BLABELA EXEC is the script for creating ANSI labeled tapes with the +proper signature. + +File BLABELI EXEC is a variation of the above script for creating IBM SL +label tapes with the proper signature. + +File BACULA.DATA is a dummy file required by the annoying fact that the +OS simulation routines in CMS require an actual file as input to the OS +sim file creation utility (grr). + diff --git a/bacula/examples/vm/vmbacula.tgz b/bacula/examples/vm/vmbacula.tgz new file mode 100644 index 0000000000..0309fff572 Binary files /dev/null and b/bacula/examples/vm/vmbacula.tgz differ diff --git a/bacula/examples/vm/vmbacula.txt b/bacula/examples/vm/vmbacula.txt new file mode 100644 index 0000000000..f706054c3c --- /dev/null +++ b/bacula/examples/vm/vmbacula.txt @@ -0,0 +1,28 @@ +Tape Mount Client/Server for z/VM + +This package provides a simple Linux client and a VM disconnected +virtual machine allowing Linux applications to mount and manage +tapes hosted by a z/VM systems. + +The tools were written to support running Bacula, a open-source +file level backup tool, as a Linux appliance running in a z/VM +virtual machine, however they are general purpose enough to +employ with other applications with some minor thought. The +application consists of a Perl script to run within the Linux +guest, and a REXX/CMS Pipelines-based server to interact with a +CMS-based tape management system. + +This package contains only the support for basic VM tape +operations, and does not include support for the popular +commercial TMS systems such as CA-VM:Tape or others. A +commercially supported version is available for a fee from Sine +Nomine and includes detailed documentation, 24x7 support, and +additional features. Please contact Sine Nomine at info (at) +sinenomine.net for information and pricing for the full +commercial version of the software. + + +This software is distributed according to the Artistic License. +Please send bugs or suggestions to deb390 (at) sinenomine.net. + +Web site: http://sinenomine.net/vm/tapemount diff --git a/bacula/src/win32/cygwin.NET.bashrc b/bacula/src/win32/cygwin.NET.bashrc new file mode 100644 index 0000000000..07f4c639c2 --- /dev/null +++ b/bacula/src/win32/cygwin.NET.bashrc @@ -0,0 +1,63 @@ +export ALLUSERSPROFILE='C:\Documents and Settings\All Users' +export APPDATA='C:\Documents and Settings\Rick\Application Data' +export BASEMAKE='C:\Program Files\Microsoft SDK\Include\BKOffice.Mak' +export BASH=/usr/bin/bash +export BKOFFICE='C:\Program Files\Microsoft SDK\.' +export CLIENTNAME=Console +export COLORFGBG='0;default;15' +export COLORTERM=rxvt-xpm +export COLUMNS=70 +export COMMONPROGRAMFILES='C:\Program Files\Common Files' +export COMPUTERNAME=RICK_LPATOP +export COMSPEC='C:\WINDOWS\system32\cmd.exe' +export CYGWIN=notty +export DIRSTACK=() +export DISPLAY=:0 +export GROUPS=() +export HISTFILE=/cygdrive/c/home/Rick/.bash_history +export HISTFILESIZE=500 +export HISTSIZE=500 +export HOME=/cygdrive/c/home/Rick +export HOMEDRIVE=C: +export HOMEPATH='\Documents and Settings\Rick' +export HOSTNAME=RICK-LPATOP +export HOSTTYPE=i686 +export IFS=$' \t\n' +export INCLUDE='C:\Program Files\Microsoft SDK\Include\.;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\atlmfc\include;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\include' +export INETSDK='C:\Program Files\Microsoft SDK\.' +export LIB='C:\Program Files\Microsoft SDK\Lib\.;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\atlmfc\lib;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\lib' +export LINES=65 +export LOGONSERVER='\\RICK-LPATOP' +export MACHTYPE=i686-pc-cygwin +export MAILCHECK=60 +export MAKE_MODE=UNIX +export MSSDK='C:\Program Files\Microsoft SDK\.' +export MSTOOLS='C:\Program Files\Microsoft SDK\.' +export NUMBER_OF_PROCESSORS=1 +export OLDPWD=/home/Rick/bacula +export OPTERR=1 +export OPTIND=1 +export OS=Windows_NT +export OSTYPE=cygwin +export PATH='/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/VC7/Bin:/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/VC7:/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/Common/Tools/Bin:/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/Common/Tools:/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/Common7/IDE:c:/cygwin/bin:/usr/bin:/home/sbarn/bin:/sbin:/usr/sbin:' +export PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH' +export PROCESSOR_ARCHITECTURE=x86 +export PROCESSOR_IDENTIFIER='x86 Family 6 Model 8 Stepping 10, GenuineIntel' +export PROGRAMFILES='C:\Program Files' +export PROMPT='$P$G' +export PWD=/home/Rick +export SESSIONNAME=Console +export SHELL=/usr/bin/bash +export SHLVL=1 +export SYSTEMDRIVE=C: +export SYSTEMROOT='C:\WINDOWS' +export TEMP=/cygdrive/c/DOCUME~1/Rick/LOCALS~1/Temp +export TERM=xterm +export TMP=/cygdrive/c/DOCUME~1/Rick/LOCALS~1/Temp +export USERDOMAIN=RICK-LPATOP +export USERNAME=rick +export USERPROFILE='C:\Documents and Settings\Rick' +export WINDIR='C:\WINDOWS' +export WINDOWID=168050736 +export WXWIN='c:\cygwin\home\Rick\bacula\depkgs-win32\wx' +