LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Shell script can't mount using CIFS (https://www.linuxquestions.org/questions/red-hat-31/shell-script-cant-mount-using-cifs-621960/)

James H 02-18-2008 05:16 AM

Shell script can't mount using CIFS
 
Hello! Just registered with the forum after being a long time lurker and I've got a question...

I'm trying to get two RH servers to mount on the fly to two different Windows server shares to transfer some files across to both Windows servers.

If I execute the script manually (ie. ./script.sh) the mounts are created and subsequently unmounted and I can see this happening in front of me.

However, when I try and schedule the scripts to be executed at a specific time using crontab, the files are moved as they should be, but nothing appears to mount (as in I can't see anything appear on the Windows servers like I can when I manually run the .sh scripts).

Has anyone got any ideas why this should be the case? Could it be a permissions issue with exectuting the script from crontab? I'm definitely trying to do all of this as root, but I am a bit of a Red Hat newbie...

Here's my shell script:

Code:

# mount to Windows share

mount.cifs /mount/root/automation //[WINDOWS SERVER 1]/Import -o,username=import%import

# move file into automation

cd /mount/root/source

mv today.txt /mount/root/automation

# unmount Windows share

umount.cifs /mount/root/automation

Thanks in advance for any assistance... I can't work out why this should work manually but not via cron!

James H 02-18-2008 05:50 AM

Looks like all I needed to do was specify /sbin/mount.cifs and now it all works when run up by cron... :D

mtimbro 02-18-2008 07:17 AM

Quote:

Originally Posted by James H (Post 3061207)
Looks like all I needed to do was specify /sbin/mount.cifs and now it all works when run up by cron... :D

Yeah one suggestion I could give you is *always* specify full paths when wanting to automate jobs.

Cheers,


All times are GMT -5. The time now is 01:59 PM.