techmiss
asked on
Unix Script Not Giving Desired Result
Hi all,
I am using the command:
mount -t cifs //10.41.5.242/warehouse -o username=warehouse,passwor d=password /mnt/warehouse_win
This command works ok, however when I put it in a script it returns with the error:
"mount error: can not change directory into mount target /mnt/warehouse_win"
I have whittled down my script so it now only contains the mount command to try and eliminate the problem so i've obviously donw something wrong somewhere.
Cheers
K
I am using the command:
mount -t cifs //10.41.5.242/warehouse -o username=warehouse,passwor
This command works ok, however when I put it in a script it returns with the error:
"mount error: can not change directory into mount target /mnt/warehouse_win"
I have whittled down my script so it now only contains the mount command to try and eliminate the problem so i've obviously donw something wrong somewhere.
Cheers
K
ASKER
Yes the mount point exists, as I ran the command outside of the script and it worked fine.
Below is by desired mount point.
[root@server /]# ls -l /mnt
total 4
drwxr-xr-x 2 root root 4096 Apr 22 13:59 warehouse_win
Thanks
K
Below is by desired mount point.
[root@server /]# ls -l /mnt
total 4
drwxr-xr-x 2 root root 4096 Apr 22 13:59 warehouse_win
Thanks
K
Please post the script. From what I see here this should work. As a test I used the following script:
#!/bin/bash
# Mount the directory
mount -t cifs //192.168.1.50/PDFStorage -o username=jfaubion,password =MyPassWd /mnt/warehouse_win
This mounts with no issues on both Fedora 12 and Centos 5.4. Granted not Red Hat exactly but the closest flavors I had available tonight.
#!/bin/bash
# Mount the directory
mount -t cifs //192.168.1.50/PDFStorage -o username=jfaubion,password
This mounts with no issues on both Fedora 12 and Centos 5.4. Granted not Red Hat exactly but the closest flavors I had available tonight.
ASKER
Hi,
Code is below, when I run this script using ./scriptname.sh I now get the message:
": bad interpreter: No such file or directory"
When I run the same mount command at the command line it mounts successfully.
Thanks
K
Code is below, when I run this script using ./scriptname.sh I now get the message:
": bad interpreter: No such file or directory"
When I run the same mount command at the command line it mounts successfully.
Thanks
K
#!/bin/bash
#mount the directory
mount -t cifs //10.41.5.242/warehouse -o username=warehouse,password=password /mnt/warehouse_win
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
So did that fix the issue?
did you whittle your script down a lot?
I have to agree with jfaubiontx about the error above, I'd bet you've got ^M chars at the end of the lines.
I'm also wondering if /mnt is mounted by something else before, I only ask because you did not show the interpreter error in your original Q.
I have to agree with jfaubiontx about the error above, I'd bet you've got ^M chars at the end of the lines.
I'm also wondering if /mnt is mounted by something else before, I only ask because you did not show the interpreter error in your original Q.
ASKER
Was the second option - script was indeed edited in notepad.
Thanks.
Thanks.
file /mnt/warehouse_win
ls -l /mnt