#!/bin/bash
#Version: 1.0
#Description: Checks for a destination mount directory. Mounts it if it does not exist, the backs up the server to the mount directory.
mountdir="<mount directory>"
servername="<servername>"
exclusions="--exclude=/mnt --exclude=/proc --exclude=/lost+found --exclude=/tmp --exclude=/media --exclude=/sys --exclude=/dev --exclude=/run --exclude=/var/cache"
if [ -d $mountdir ]; then
cd $mountdir
tar -zcpf $servername-full-backup-`date '+%d-%B-%Y'`.tar.gz / $exclusions
else
sudo mount -t cifs -o username=moatisuser,password=moatisuser,rw \\\\fw24\\ata_1 /mnt/fw24
cd $mountdir
tar -zcpf $servername-full-backup-`date '+%d-%B-%Y'`.tar.gz / $exclusions
fi
No comments:
Post a Comment
Thank you for your comment.