LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 01-31-2006, 06:26 PM   #1
RodWC
Member
 
Registered: Oct 2005
Distribution: Debian Etch i386, Lenny and Sid amd64
Posts: 177

Rep: Reputation: 30
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.
 
Old 01-31-2006, 06:50 PM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
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
 
Old 01-31-2006, 07:33 PM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by RodWC
... such as: "cp -a /home/rodney/documents smb://debian/Disk-2/documents".
Do you have a regular user account on the remote server?

If so, something like this would probably do the trick:
Code:
rsync -ave ssh /home/rodney/documents/ userid@remote_server:/backup_directory/documents/
 
Old 01-31-2006, 08:02 PM   #4
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
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
mv /destination/snapshot.2 /destination/snapshot.3
mv /destination/snapshot.1 /destination/snapshot.2
mv /destination/snapshot.0 /destination/snapshot.1

rsync --verbose \
      --archive \
      --one-file-system \
      --modify-window=1 \
      --link-dest=/destination/snapshot.1 \
      --delete \
      --delete-after \
      --delete-excluded \
      --filter="merge /etc/rsync/default.rules" \
      --filter="dir-merge /.rsync_filter" \
        /source/directory/ \
        /destination/snapshot.0

touch /destination/snapshot.0
 
Old 02-01-2006, 05:33 PM   #5
RodWC
Member
 
Registered: Oct 2005
Distribution: Debian Etch i386, Lenny and Sid amd64
Posts: 177

Original Poster
Rep: Reputation: 30
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)?
 
Old 02-02-2006, 03:35 AM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by RodWC
Brian, I'm not sure what you mean; can you actually mount a samba share locally (from another computer)?
You can, with the smbmount command.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I access metadata from the command line? WilliamMcMath Linux - General 1 11-03-2005 02:04 PM
Disk Access from the Command Line in the Debian3.1 Installer j@ckrabbit Debian 5 08-19-2005 05:45 PM
Can I access the INTERNET from the command line???? Guvvy Linux - Newbie 4 02-02-2005 10:07 PM
Access Floppy From Command Line Login?.... Stealthy_C Linux - General 1 03-05-2004 02:33 PM
A Linux command line to access the domain name of a windows PDC server Linh Linux - Networking 0 08-04-2003 05:13 PM


All times are GMT -5. The time now is 07:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration