| View previous topic :: View next topic |
| Author |
Message |
tekno_guru n00b

Joined: 28 Dec 2005 Posts: 45
|
Posted: Sun Apr 06, 2008 11:32 am Post subject: Mount cifs shell script <SOLVED> |
|
|
I am attempting to right a bash script to mount a W2K3 box, copy a directory to the gentoo box and then unmount it. I want to set it up as a cron job to fire ever 30 days. I am having a problem with the mount portion though. my mount statement is
| Code: | | mount -t cifs -o user=user;password=password //Ip.address/d$ /myshare |
or
| Code: | | mount.cifs //Ip.address/d$ /myshare -o user=user;password=password,domain=localhost |
either of these will work from the console, but neither works in the script. my script is sitting in /, and has the #!/bin/bash statement at the top. It does not throw an error, just says "Script started, file is typescript" and then nothing happens. I understand I could but it in the fstab and let it get mounted, however, i do not want to maintain a constant share session between the two boxes. Just want it long enough to run the copy statement, for backup, and then umount the share.
Thank you for your help in advance.
Last edited by tekno_guru on Mon Apr 07, 2008 4:37 pm; edited 1 time in total |
|
| Back to top |
|
 |
vad3r Guru


Joined: 02 May 2004 Posts: 450 Location: Munich, Germany
|
Posted: Sun Apr 06, 2008 2:06 pm Post subject: |
|
|
You should use absolute paths to the mount binary. You should do this for every script... _________________ -- http://www.linuxaddicted.de/ | Please help to answer open questions |
|
| Back to top |
|
 |
tekno_guru n00b

Joined: 28 Dec 2005 Posts: 45
|
Posted: Sun Apr 06, 2008 7:26 pm Post subject: |
|
|
i have tried with the absolute path to both mount and mount.cifs. I will post the script below, please let me know if you see something wrong. Does the script have to be run with a set of credentials? I am attempting to run it while logged in as root.
| Code: |
#!/bin/bash
/bin/mount -t cifs -o user=username,password=password,domain=localhost,ro //ipaddress/share /myshare
|
This does work from the console. Thanks again. |
|
| Back to top |
|
 |
vad3r Guru


Joined: 02 May 2004 Posts: 450 Location: Munich, Germany
|
Posted: Mon Apr 07, 2008 3:56 am Post subject: |
|
|
Do you added this script to root's crontab? If you haven't set "user" for your share in /etc/fstab you are only allowed to mount as root. Are you sure that there's no log entry or dead.letter with more information? _________________ -- http://www.linuxaddicted.de/ | Please help to answer open questions |
|
| Back to top |
|
 |
tekno_guru n00b

Joined: 28 Dec 2005 Posts: 45
|
Posted: Mon Apr 07, 2008 9:36 am Post subject: |
|
|
| I found i was calling the script with /root/scriptname and not /root/sriptname.sh. Is this normal in linux? I thought it would run it as it executable and had the .sh extension. |
|
| Back to top |
|
 |
vad3r Guru


Joined: 02 May 2004 Posts: 450 Location: Munich, Germany
|
|
| Back to top |
|
 |
tekno_guru n00b

Joined: 28 Dec 2005 Posts: 45
|
Posted: Mon Apr 07, 2008 4:37 pm Post subject: |
|
|
| Yes. Thanks again. |
|
| Back to top |
|
 |
|