I finally got everything working!
I used a pull script to pull backup all FILES from the network. Then I used a second script that runs from the ESXi host to push the vms over. I used XSIbackup (open source/free) for this, which supports many things including hot backups.
Here's what ended up working:
#Hardware: x86 box with a good raid config (like raid 1 or 10).
#I used 4 partitions for this deployment: OS(small), Dir1"sdd1" (big), Dir2 "sdd2" (bigger), and vault"sdc" (biggest).
#Software: Debian, dependencies are pretty much met out of the box. You will need Rsync and Samba if you made a minimal install.
#XSi-Backup, a respected open source backup solution that supports hot-running vm backups. Installation is spelled out in this script.
#Connect the server to the network via a static IP, make sure it can ping everything it needs to reach.
#make sure sdc is umounted by default, sdd1 is mounted to /backup/Dir1, and sdd2 is mounted to /backup/Dir2
#run the script:
mount -t cifs //serverip/sharedir/ /backup/dir1 -o credentials=/credentialslocation
#this mounts the entire shared drive using a root read only credentials file
sleep 10s
rsync -avz /backup/dir1/ /backup/dir2
#backs up the data from dir1 to dir2
sleep 10s
umount /backup/dir1
#unmounts windows share
sleep 10s
mount -t //server/"share with spaces"/ backup/dir1 -o credentials=/credentialslocation
#Mount the PLC share
sleep 10s
rsync -avz /backup/dir1 /backup/dir2
#syncs share to dir2
#note* an "infinite" amount of directories can be backed up this way
sleep 10s
umount /backup/dir1
#unmounts share
sleep 20s
freshclam
#antivirus update
sleep 10s
clamscan -r --bell -i /
#scan entire filesystem and hault/ring a bell (alert) upon threat detection, stopping the script.
sleep 10s
mount /dev/sdc /backup/vault
#mounts the backup vault
sleep 10s
rsync -avz /backup/dir2/ /mnt/bak8
#syncs temp dir2 to the vault
sleep 10s
umount /mnt/bak8
#unmounts vault
sleep 10s
#end of script.
Here's how I got the vms backed up:
install XSibackup:
cd /vmfs/volumes/datastore1/xsi-dir 2>/dev/null || mkdir /vmfs/volumes/datastore1/xsi-dir && \
cd /vmfs/volumes/datastore1/xsi-dir && \
esxcli network firewall unload && \
wget
http://33hops.com/downloads/?key=ojW...ziaiJYXquxoIaR -O xsibackup.zip && \
unzip -o xsibackup.zip && \
chmod 0700 xsibackup* && \
rm -rf xsibackup.zip && \
esxcli network firewall load
Now set up Dir2 on the server as an NFS share to be mounted via the ESXi cli or vsphere.
Now we cron this script:
./xsibackup --backup-point=/vmfs/volumes/newnfsdatastore --backup-type=ALL
#this pushes clones of the hot and cold vms directly to the backup server where it will pick them up from Dir2 and drop them into the vault automatically.
This is the rough draft/launch of this little project. I have a lot of cleaning up to do and many improvements to make. Any help is greatly appreciated.
Thanks,