As Suprstar suggests, having a shared, writeable folder on the Windows machine and mounting it through a script is the simplest way of doing it. There are a few things you need to consider if it is to be an automated operation....
First, it seems that mount sometimes takes a little while to settle, and attempting to write to the mounted share before it has settled will cause problems. Second, in an automated system, I would want a bit of error checking, and some way to tell if things have gone wrong.
This is adapted from a script I use to backup an SME server system to a Samba share:
Code:
#!/bin/bash
mount -t cifs - user=synbak%Synbak1 //192.168.1.10/share /mnt/backup
sleep 4 #allow the mount to stabalize before attempting to write to it
if [ -d /mnt/backup/box1 ]; then
cp /home/notme/* /mnt/backup/box1
sleep 20 #make sure any cached data has been written to the share
umount /mnt/backup
else
# Generate a log entry if the mount failed
echo "`date +%m+%d-%R` Mount failed, backup aborted" >> /var/log/backup.log
fi
Using the -d test, I check fo the existance of a directory on the share (which checks that the mount command has worked), then go on with the copy. If the mount failed, I get a log entry that reminds me to check what went wrong. If the system is set up for it, an email message could be used instead of a log.
One other thing you need to consider is the type of files you are copying. If it is just data files, it probably doesn't matter. But, if you are backing up something like your home directory, you need to remember that copying files to a Windows share will not preserve the owner and permissions data that Linux uses. Under those circumstances, you would be better using something like tar (with optional compression) rather than copying. Tar will allow you to preseve the permissions and ownership data, which will prevent problems if you need to copy the files back.
In that instance, you could use something like this in place of the copy command:
Code:
tar czvpf /mnt/backup/box1/backup.tar.gz .
There are lots of other options, but that should give you some starting points.
Paul.