#!/bin/bash
# Based on a script by Adam Neat and modified in 2003 by Matthew Durnford
# Comments, modification, improvements etc to matthew@rosemounttechnology.com
# This script comes with no warranty, use it at your own risk.

# This script lists all the users and directories to be backed up and provides the variables
# to the win_backup script

clear
logfile="/home/admin/logs/backup.log"
cd ~admin/backup/
date > "$logfile"
echo "Initialising backup ......." >> "$logfile"


if [ ! -d ~admin/backup/current ]; then

mkdir -m 750 ~admin/backup/current

fi

if [ ! -d ~admin/backup/old ]; then

mkdir -m 750 ~admin/backup/old

fi

echo "Finished initialising. Now starting first computer backup ...." >> "$logfile"

##############################################################################
#
# Ths list below is of all the shares that need backing up
# The variables are $1=computer name, $2=service name, $3=backup directory on
# backup server, $4=smbclient config file, $5=username%password.
#
##############################################################################


./win_backup.sh computer_name share_name backup_directory ~admin/backup/backup.cfg user%password

##############################################################################
#
# Add all backup configurations above this line
#
##############################################################################

echo "backup completed on :- " >> "$logfile"
date >> "$logfile"

# Email results to admin
mail -s "Backup log" admin < "$logfile"