# mount_smbfs in crontab



## kandombe (Mar 8, 2006)

I have some scheduled tasks whose results should go to a common computer so that other people can access them. That's why I have included in my .sh file a command such as

mount_smbfs //userassword@host/shared_folder /Volumes/shared_point
cp some_files
umount /Volumes/shared_point

The problem is that this script works perfectly when running from the Terminal but the samba remote volume refuses to mount when the process is activated from crontab.

Any ideas? Thanks in advance for the help.


----------



## tomdkat (Mar 8, 2006)

Did you schedule the script to run as your id or as root?  Try to schedule the script to run as root and see if that helps.

Either su to root and schedule it via cron or use sudo.

I'm sure more experienced OS X users will supply a better solution.  

Peace...


----------



## kandombe (Mar 9, 2006)

Thanks for the idea but it didn't work, and it is not logical that a script that runs ok when launched from the Terminal doesn't work when scheduled with crontab.
I've even tried to change the permissions in crontab by doing
chmod u-s /usr/bin/crontab
in case that it's assuming another user ID when running the task, but it didn't work either.
I'm running out of ideas. Any help will be welcome.


----------



## kandombe (Mar 9, 2006)

Sorry to all. I was soooo stupid

I just forgot to establish the PATH environment at the beginning of my script, so it worked from the Terminal (sure) but couldn't find the mount_smbfs location when launched from crontab.


----------



## tomdkat (Mar 9, 2006)

Glad you got it figured out!  How did you come to the conclusion it was a lack of PATH setting?

Peace...


----------



## kandombe (Mar 10, 2006)

Just looking to other scripts that I had prepared using the snmp package, in which I had included the path to find the snmp commands. That's why I felt so stupid, because I made a mistake that I had easily avoided before.

In any case, I'd like to write it clearly here in case that it can be useful to somebody in the future.

I like your way of ending the messages.

Peace ...


----------



## tomdkat (Mar 10, 2006)

kandombe said:
			
		

> Just looking to other scripts that I had prepared using the snmp package, in which I had included the path to find the snmp commands. That's why I felt so stupid, because I made a mistake that I had easily avoided before.


Cool. 



> I like your way of ending the messages.
> 
> Peace ...


Yeah, that's something I tend to do.  My "trademark", so to speak.    If you're familiar with the rap artist "Chubb Rock", that's how he closes the song, "_Treat 'em right_"  

Peace...


----------

