#!/bin/sh
# configbackup -- copies various important files to some specified backup
# location
# http://www.jpsdomain.org/linux/OnStream_DI-30-RedHat_Backup_mini-HOWTO.html
# v1.0 25-Feb-2001 JP Vossen
# From CDBackup.bat and Srv-Bk.bat

# Copyright 2001 JP Vossen
# This script is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
# General Public License for more details.

# In no event shall the author be liable for any damages whatsoever
# (including, without limitation, damages for loss of business profits,
# business interruption, loss of business information, or any other
# pecuniary loss) arising out of the use of or inability to use this script.


if [ -z $1 ]; then
    echo ""
    echo "Usage: $0 {destination directory}"
    echo ""
    echo "	Copies various important files to {dest} as backups."
    echo ""
    exit 1
fi

# Could do other interesting things here, like making the destination dir:
# Mon, Tue, Wed, Jan, Feb, Mar, week number (+%W) etc.
# Use the date command, like DESTDIR=/root/`date +%a` or `date +%b`
# Then disable the usage above
DESTDIR=${1%%/}                     # Remove any trailing /

# Output is suitable for redirection into a log file, if you care...
echo "Starting $0 on `date`"

echo "Copy Web Server stuff"
# cp -fPR /home/home/httpd/           ${DESTDIR}/Web/	# This gets the Apache
							# manual too.
cp -fPR /home/httpd/cgi-bin/        ${DESTDIR}

echo "Copy Specific, individual config files"
cp -vfP /etc/HOSTNAME               ${DESTDIR}
cp -vfP /etc/MACHINE.SID            ${DESTDIR}
cp -vfP /etc/TextConfig             ${DESTDIR}
cp -vfP /etc/X11/XF86Config         ${DESTDIR}
cp -vfP /etc/aliases                ${DESTDIR}
cp -vfP /etc/aliases.db             ${DESTDIR}
cp -vfP /etc/at.deny                ${DESTDIR}
cp -vfP /etc/auto.master            ${DESTDIR}
cp -vfP /etc/auto.misc              ${DESTDIR}
cp -vfP /etc/bashrc                 ${DESTDIR}
cp -vfP /etc/comanche.conf          ${DESTDIR}
cp -vfP /etc/conf.linuxconf         ${DESTDIR}
cp -vfP /etc/conf.modules           ${DESTDIR}
cp -vfP /etc/crontab                ${DESTDIR}
cp -vfP /etc/csh.cshrc              ${DESTDIR}
cp -vfP /etc/dhcpd.conf             ${DESTDIR}
cp -vfP /etc/dosemu.conf            ${DESTDIR}
cp -vfP /etc/dosemu.users           ${DESTDIR}
cp -vfP /etc/dumpdates              ${DESTDIR}
cp -vfP /etc/exports                ${DESTDIR}
cp -vfP /etc/fstab                  ${DESTDIR}
cp -vfP /etc/ftpaccess              ${DESTDIR}
cp -vfP /etc/ftpconversions         ${DESTDIR}
cp -vfP /etc/ftpgroups              ${DESTDIR}
cp -vfP /etc/ftphosts               ${DESTDIR}
cp -vfP /etc/ftpusers               ${DESTDIR}
cp -vfP /etc/gettydefs              ${DESTDIR}
cp -vfP /etc/group                  ${DESTDIR}
cp -vfP /etc/host.conf              ${DESTDIR}
cp -vfP /etc/hosts                  ${DESTDIR}
cp -vfP /etc/hosts.allow            ${DESTDIR}
cp -vfP /etc/hosts.deny             ${DESTDIR}
cp -vfP /etc/inetd.conf             ${DESTDIR}
cp -vfP /etc/inittab                ${DESTDIR}
cp -vfP /etc/inputrc                ${DESTDIR}
cp -vfP /etc/isapnp.gone            ${DESTDIR}
cp -vfP /etc/issue                  ${DESTDIR}
cp -vfP /etc/issue.net              ${DESTDIR}
cp -vfP /etc/lilo.conf              ${DESTDIR}
cp -vfP /etc/lmhosts                ${DESTDIR}
cp -vfP /etc/login.defs             ${DESTDIR}
cp -vfP /etc/logrotate.conf         ${DESTDIR}
cp -vfP /etc/lynx.cfg               ${DESTDIR}
cp -vfP /etc/mail.rc                ${DESTDIR}
cp -vfP /etc/man.config             ${DESTDIR}
cp -vfP /etc/mtab                   ${DESTDIR}
cp -vfP /etc/named.boot             ${DESTDIR}
cp -vfP /etc/named.conf             ${DESTDIR}
cp -vfP /etc/networks               ${DESTDIR}
cp -vfP /etc/ntp.conf               ${DESTDIR}
cp -vfP /etc/nwserv.conf            ${DESTDIR}
cp -vfP /etc/nwserv.stations        ${DESTDIR}
cp -vfP /etc/pam.conf               ${DESTDIR}
cp -vfP /etc/passwd                 ${DESTDIR}
cp -vfP /etc/profile                ${DESTDIR}
cp -vfP /etc/protocols              ${DESTDIR}
cp -vfP /etc/pwdb.conf              ${DESTDIR}
cp -vfP /etc/redhat-release         ${DESTDIR}
cp -vfP /etc/resolv.conf            ${DESTDIR}
cp -vfP /etc/rmt                    ${DESTDIR}
cp -vfP /etc/rpc                    ${DESTDIR}
cp -vfP /etc/screenrc               ${DESTDIR}
cp -vfP /etc/securetty              ${DESTDIR}
cp -vfP /etc/sendmail.cf            ${DESTDIR}
cp -vfP /etc/sendmail.cw            ${DESTDIR}
cp -vfP /etc/sendmail.mc            ${DESTDIR}
cp -vfP /etc/services               ${DESTDIR}
cp -vfP /etc/shadow                 ${DESTDIR}
cp -vfP /etc/shells                 ${DESTDIR}
cp -vfP /etc/smb.conf               ${DESTDIR}
cp -vfP /etc/smbpasswd              ${DESTDIR}
cp -vfP /etc/smbusers               ${DESTDIR}
cp -vfP /etc/snmpd.agentinfo        ${DESTDIR}
cp -vfP /etc/snmpd.conf             ${DESTDIR}
cp -vfP /etc/squid.conf             ${DESTDIR}
cp -vfP /etc/squid.conf.default     ${DESTDIR}
cp -vfP /etc/syslog.conf            ${DESTDIR}
cp -vfP /etc/tw.config              ${DESTDIR}
cp -vfP /etc/wgetrc                 ${DESTDIR}

echo "Copy all rc and .conf files"
cp -vfP /etc/*rc                    ${DESTDIR}
cp -vfP /etc/*.rc*                  ${DESTDIR}
cp -vfP /etc/*.conf                 ${DESTDIR}

echo "Copy rc.d files"
cp -vfPR /etc/rc.d/*                ${DESTDIR}

echo "Copy config files for log rotations"
cp -vfP /etc/logrotate.d/*          ${DESTDIR}

echo "Copy security files"
cp -vfPR /etc/security/*            ${DESTDIR}

echo "Copy DNS files (chrooted)"
cp -vfPR /home/dns/var/named/*      ${DESTDIR}

echo "Finished $0 on `date`"

