Skip to content

Instantly share code, notes, and snippets.

@lovellfelix
Created October 17, 2013 21:24
Show Gist options
  • Save lovellfelix/7032429 to your computer and use it in GitHub Desktop.
Save lovellfelix/7032429 to your computer and use it in GitHub Desktop.
Amanda bash file setup on CentOS
#!/bin/bash
#INSTALLING AMANADA
yum install -y amanda amanda-client
#SETTING UP AMANDA CONFIG
su - amandabackup
rm -rf /var/lib/amanda/.amandahosts
cat > /var/lib/amanda/.amandahosts <<END
# Allow access to amanda over the network. See 'man amanda'
# 'ambackup' connects to 'amandad'. If your 'disklist' is correctly
# set up, i.e. if it does not use 'localhost' but the fully qualified
# domain name (FQDN) of the target machine, then you must put
# the FQDN here. 'ambackup' must be run by user 'amandabackup', so we allow
# access by user 'amandabackup'. Do not forget to add an 'only_from' line to
# '/etc/xinet.d/amanda' to allow access to 'amandad' only from known
# IP addresses.
# replace mymachine.mydomain by the correct value and uncomment
# mymachine.mydomain amandabackup
# 'amrecover' connects to 'amandaidx', which uses the fully qualified
# domain name when access is done from another machine. 'amrecover'
# must be run by user 'root', so we allow access by user 'root'.
# replace mymachine.mydomain by the correct value and uncomment
# mymachine.mydomain root
# 'amrecover' connects to 'amandaidx', which uses the bare machine
# name w/o domain name when access is done from the same machine.
# 'amrecover' must be run by user 'root', so we allow access by user
# 'root'.
# replace mymachine by the correct value and uncomment
# mymachine root
#
dev-amanda-svr amandabackup amdump
localhost amandabackup amdump
localhost.localdomain amandabackup amdump
END
exit
rm -rf /etc/xinetd.d/amanda
cat > /etc/xinetd.d/amanda <<END
# default: off
# description: The client for the Amanda backup system.\
# This must be on for systems being backed up\
# by Amanda.
service amanda
{
socket_type = dgram
protocol = udp
wait = yes
user = amandabackup
group = disk
server = /usr/sbin/amandad
# Configure server_args for the authentication type you will be using,
# and the services you wish to allow the amanda server and/or recovery
# clients to use.
#
# Change the -auth= entry to reflect the authentication type you use.
# Add amindexd to allow recovery clients to access the index database.
# Add amidxtaped to allow recovery clients to access the tape device.
server_args = -auth=bsd amdump amindexd amidxtaped
disable = no
}
END
#RUN AMANDA ON BOOT
chkconfig xinetd on
service xinetd start
#SERVER HOST RESOLVER HELPER
echo 192.168.168.67 dev-amanda-svr >> /etc/hosts
#ADD SPECIFIC FOLDERS TO BACKUP
cat > /bin/add-backup <<END
#!/bin/bash
if [ -z "$1" ]
then
echo "EXAMPLE: add-backup /home/user/Documents"
exit
fi
chmod 755 "$1"
service xinetd
echo backup job $1 created.
END
#FIXED PERMISSION
chmod 755 /bin/add-backup
echo Installation done.
echo to create a new backup job, run
echo add-backup folderPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment