Hi - I've been working on creating a script to backup files from a Windows computer on my network to a Backup Dataset I've created on FreeNAS 11.1
The approach I've taken is a to mount the share, tar and finally unmount. The commands are working when entered one at a time manually but I'm having issues when the same is run from the script.
What I think is happening is the script is running to the next step / command before completing the prior.
for e.g. The tar file is incomplete. I suspect the unmount occurs whilst the tar command is still running.
If I'm right, what can be done to ensure steps complete before moving to the next? Alternatively, am i approaching this task the right way?
The approach I've taken is a to mount the share, tar and finally unmount. The commands are working when entered one at a time manually but I'm having issues when the same is run from the script.
What I think is happening is the script is running to the next step / command before completing the prior.
for e.g. The tar file is incomplete. I suspect the unmount occurs whilst the tar command is still running.
If I'm right, what can be done to ensure steps complete before moving to the next? Alternatively, am i approaching this task the right way?
Code:
#!/bin/bash mount_smbfs -N -I 10.0.0.10 //user@Server/Share /mnt/Server/Share tar --exclude /mnt/Server/Share/FolderX -zcvf /mnt/Pool/Backup/X/Y/Z.tar.gz /mnt/Server/Share umount /mnt/Server/Share