Gentoo Forums
Gentoo Forums
Quick Search: in
Mount cifs shell script <SOLVED>
View unanswered posts
View posts from last 24 hours

rackathon
 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
tekno_guru
n00b
n00b


Joined: 28 Dec 2005
Posts: 45

PostPosted: Sun Apr 06, 2008 11:32 am    Post subject: Mount cifs shell script <SOLVED> Reply with quote

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
View user's profile Send private message
vad3r
Guru
Guru


Joined: 02 May 2004
Posts: 450
Location: Munich, Germany

PostPosted: Sun Apr 06, 2008 2:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
tekno_guru
n00b
n00b


Joined: 28 Dec 2005
Posts: 45

PostPosted: Sun Apr 06, 2008 7:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
vad3r
Guru
Guru


Joined: 02 May 2004
Posts: 450
Location: Munich, Germany

PostPosted: Mon Apr 07, 2008 3:56 am    Post subject: Reply with quote

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
View user's profile Send private message
tekno_guru
n00b
n00b


Joined: 28 Dec 2005
Posts: 45

PostPosted: Mon Apr 07, 2008 9:36 am    Post subject: Reply with quote

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
View user's profile Send private message
vad3r
Guru
Guru


Joined: 02 May 2004
Posts: 450
Location: Munich, Germany

PostPosted: Mon Apr 07, 2008 10:09 am    Post subject: Reply with quote

You have to call it with the full name. Is your problem solved now?
_________________
-- http://www.linuxaddicted.de/ | Please help to answer open questions
Back to top
View user's profile Send private message
tekno_guru
n00b
n00b


Joined: 28 Dec 2005
Posts: 45

PostPosted: Mon Apr 07, 2008 4:37 pm    Post subject: Reply with quote

Yes. Thanks again.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum