Is it possible to access samba server from command line?
Hi all, the subject already asks the question. :) The reason I ask is that I would like to be able to set something up (like cron, or just a "clickable" script) to backup/synchronize certain directories on my computer with a server. I can do it through KDE with drag and drop, but that is not a very good solution for me. Something along the lines of "SyncBack" (http://www.2brightsparks.com/syncbac...back-hub.html). If I could write a script that would be able to copy files back and forth via samba, that would work too. such as: "cp -a /home/rodney/documents smb://debian/Disk-2/documents". Obviously, that does not work! But that's generally the idea of what I want to accomplish.
Any suggestions appreciated. |
For a script use the mount command to mount the share, copy files to the share mount location, and then umount the share. I think this is what you are after.
Brian1 |
Quote:
If so, something like this would probably do the trick: Code:
rsync -ave ssh /home/rodney/documents/ userid@remote_server:/backup_directory/documents/ |
I am writing my own backup script that sounds similar to what you're attempting to do. Below is what I've gotten written so far. It is a "proof of concept" framework only. I HAVE NOT TRIED EXECUTING IT YET! But you can get the general idea of where I'm heading by looking at the (possibly incorrect - no, PROBABLY incorrect!) code below. I just threw in likely looking candidate parameters into my proof-of-concept so I will remember to investigate them further. I may have specificed some incompatible options. Run "man rsync" to see all the neat things you can do with this command.
You might be able to beef it up and use something similar. I will be using my script locally, but since you want to go over a network you'd need to add something like this to the rsync command: "--rsh=ssh". And also modify the lines mentioning "destination" below to some other form consistant with a remote server as the destination. Code:
rm -rf /destination/snapshot.3 |
Thank you very much! I've been toying around with it so far, and it seems to work fine (with a few quirks, but most of those are cause by me!). Don't have much time at this point to put together a script with every little thing I want to do, but I think if I save yours for reference that will help too.
I will likely be back at another date to ask some more questions, so I'll save this thread and come back to it later. Brian, I'm not sure what you mean; can you actually mount a samba share locally (from another computer)? |
Quote:
|
All times are GMT -5. The time now is 03:17 AM. |