Having trouble with a SMB share and the CP command

Issues related to configuring your network
Post Reply
jason_nixon_205
Posts: 23
Joined: 2007/05/12 13:52:02
Contact:

Having trouble with a SMB share and the CP command

Post by jason_nixon_205 » 2007/10/04 18:15:04

I'd like to backup a few configuration files on my CentOS 4 system to my remote windows share (on the same network segment). Currently the share is permanently mounted into the Linux filesystem via Samba and the /etc/fstab. When I issue the command

cp /source/file/name /destination/file/name

the file copies with no problem. When I put the exact same command in a shell script and run it with ./ I get the error:

CP: Cannot create regular file '/source/file/name /destination/file/name: No such file or directory

The only difference I can think of between my CLI (as root) and the script would be the shell. It turns out my shell was bash and the script was set to #!/bin/sh so I changed it to #!/bin/bash, but it still gave the same error.

I would really appreciate any ideas anyone has. Thanks.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Having trouble with a SMB share and the CP command

Post by gerald_clark » 2007/10/04 20:39:56

You did not post the shell script.
I would guess you have a quoting problem.

jason_nixon_205
Posts: 23
Joined: 2007/05/12 13:52:02
Contact:

Re: Having trouble with a SMB share and the CP command

Post by jason_nixon_205 » 2007/10/07 00:04:00

Below is the text of the script (only the paths are modified). I run this exact command manually and it works. I run the script and I get the error.


#!/bin/bash
#
#backs up important files
#
cp /path/to/local/file /smb/share/path

jason_nixon_205
Posts: 23
Joined: 2007/05/12 13:52:02
Contact:

Re: Having trouble with a SMB share and the CP command

Post by jason_nixon_205 » 2007/10/10 19:34:40

Does [i]anyone[/i] have any ideas?

Post Reply

Return to “CentOS 4 - Networking Support”