LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-25-2005, 01:15 AM   #1
depam
Member
 
Registered: Sep 2005
Posts: 861

Rep: Reputation: 30
smb help


Need help..

I need to copy files from my linux box to my windows server automatically using smbclient and cron

I wrote this script :

smbclient '\\dir1\dir2' -U uname%passwd
recurse
prompt
mput *

But I can't figure out why it does not copy the files to the remote Windows server when I execute the script. Do you know any script that can do this? Or any command?

Hope you can help me.
 
Old 10-29-2005, 05:47 PM   #2
Brian1
LQ 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: 65
If you use each of those commands from a terminal session in that order, does it work fine?

If that is the contents of your script then does it have #!/bin/bash or similiar at the beggining?
Also is the script executable?

Brian1
 
Old 10-31-2005, 04:10 AM   #3
depam
Member
 
Registered: Sep 2005
Posts: 861

Original Poster
Rep: Reputation: 30
yup. I tried the smbclient '\\path\dir2' -U username%password

It prompt me with a
smb:>

It works fine when I type in recurse, prompt and copy a file.


But in a script it does not copy the files but only prompt the

smb:>

Yes, it is executable.
 
Old 10-31-2005, 04:20 PM   #4
Brian1
LQ 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: 65
A few other thoughts.
Does the commands require root to run and you are using the script as a user?
So the script does run an completes, but does not do what it needed to do?

You might need to pause between the commands. This might be over kill but you might try this. Either use the sleep command or use the universal pause. I usually use this as a pause ' ping -c2 127.0.0.1 > /dev/null '. Also don't you need something like #!/bin/bash at the beginning of the script.
Code:
#!/bin/bash
smbclient '\\dir1\dir2' -U uname%passwd
sleep 2s
recurse
sleep 2s
prompt
sleep 2s
mput *
Code:
#!/bin/bash
smbclient '\\dir1\dir2' -U uname%passwd
ping -c2 127.0.0.1 > /dev/null 
recurse
ping -c2 127.0.0.1 > /dev/null 
prompt
ping -c2 127.0.0.1 > /dev/null 
mput *
See if this helps.
Brian1

Last edited by Brian1; 10-31-2005 at 04:21 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
smb mount folders disappear on mount & konqueror smb fails: network unreachable tisource Linux - Networking 1 10-17-2007 12:30 AM
SMB: More then one Windows user/ smb account? 1veedo Linux - Networking 2 03-15-2005 04:16 PM
smb+KDE= :-) smb+Gnome= :-( awing_pilot Linux - Software 3 03-10-2005 10:38 PM
Creating a SSL connection from smb clients to a smb server scottpioso General 0 11-17-2003 02:33 PM
making smb shares viewable from smb client via web browser scottpioso General 3 11-10-2003 04:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:33 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
Open Source Consulting | Domain Registration