Skip to content

Commit

Permalink
Blocked out user configuration at the top of each script
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris Hardy committed Oct 6, 2011
1 parent 00dc974 commit 26fc04d
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 7 deletions.
29 changes: 29 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Amanda Toys
===========

Amanda Toys is a collection of scripts and utilities that I have written in order to help me administer Amanda backup servers.

They are primarily geared towards my workflow when working with hot-swap eSATA drives as "tapes".


Installation
------------

Get amanda-toys by cloning the repository: ::

$ git clone git://github.com/krishardy/amanda-toys.git

Then add the path to your local repository to your PATH, or reference the scripts using absolute paths.


Configuration
-------------

The scripts have some bit of configuration in them. Until I merge the configuration, open each file and look at the variable assignments in the top few lines.


Contributing
------------

If you like Amanda Toys, and would like to help out or send me thanks, feel free. My e-mail address is kris at rhs dot com.

15 changes: 13 additions & 2 deletions dump
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#!/bin/bash
amdump $1
amcheckdump $1

######################
# USER CONFIGURATION #
######################

AMPATH=/usr/sbin

##########################
# END USER CONFIGURATION #
##########################

$AMPATH/amdump $1
$AMPATH/amcheckdump $1
8 changes: 8 additions & 0 deletions format-tape
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/bin/bash

######################
# USER CONFIGURATION #
######################

SLOTS=/archive/vtapes/daily/slots
SLOT_PREFIX=slot
MOUNT_TAPES=/var/lib/amanda/bin/mount-tapes
AMANDA_USER=amandabackup

##########################
# END USER CONFIGURATION #
##########################

usage() {
echo "format-tape <label> <device> <slot #>"
echo
Expand Down
19 changes: 14 additions & 5 deletions mount-tapes.default
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
#!/bin/bash

LABEL_PATH=/dev/disk/by-label
######################
# USER CONFIGURATION #
######################

DEV_LABEL_PATH=/dev/disk/by-label
SLOTS_PATH=/archive/vtapes/daily/slots
USER=amandabackup
GROUP=disk

##########################
# END USER CONFIGURATION #
##########################

do_mount_by_label () {
if [ -e "$LABEL_PATH/$1" ]; then
if [ -e "$DEV_LABEL_PATH/$1" ]; then
existing_mount=$(mount|grep "$SLOTS_PATH/$2")
if [ "$existing_mount" != "" ]; then
echo "Active mount detected: $existing_mount"
echo "Continuing..."
return
fi
sudo mount -t ext3 $LABEL_PATH/$1 $SLOTS_PATH/$2
sudo mount -t ext3 $DEV_LABEL_PATH/$1 $SLOTS_PATH/$2
if [ "$?" != "0" ]; then
echo "Failed while attempting to mount $LABEL_PATH/$1 to $SLOTS_PATH/$2"
echo "Failed while attempting to mount $DEV_LABEL_PATH/$1 to $SLOTS_PATH/$2"
exit 1
fi
sudo chown $USER.$GROUP $SLOTS_PATH/$2
if [ "$?" != "0" ]; then
echo "Failed while attempting to chown $USER.$GROUP $SLOTS_PATH/$2"
exit 2
fi
echo "SUCCESS: Mounted $LABEL_PATH/$1 to $SLOTS_PATH/$2"
echo "SUCCESS: Mounted $DEV_LABEL_PATH/$1 to $SLOTS_PATH/$2"
fi
}

#A line like the one below will be automatically added to this script by
#format-tape:
#do_mount_by_label "daily-001" "slot1"

8 changes: 8 additions & 0 deletions unmount-tapes
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#!/bin/bash

######################
# USER CONFIGURATION #
######################

SLOTS_PATH=/archive/vtapes/daily/slots

##########################
# END USER CONFIGURATION #
##########################

for mount_point in `mount|grep "$SLOTS_PATH"|awk '{print $3}'`
do
if [ "$mount_point" != "" ]; then
Expand Down

0 comments on commit 26fc04d

Please sign in to comment.