DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 7th November 2008
Petrocelli08 Petrocelli08 is offline
New User
 
Join Date: Nov 2008
Posts: 7
Default Crontab won't run script

Hi All
I have a strange problem

I want to backup a directory on a FreeBSD mail server. I set up a script which runs the mount_smbfs command. It mounts the remote windows share, tars up the directory, copies it to the share and then unmounts the share. In I run it from the command line it works like so ./backup.sh or /usr/local/etc/backup.sh
When I it runs from /etc/crontab, I get this error below:

mount_smbfs: unable to open connection: syserr = Authentication error
umount: /home/backup: not a file system root directory

Any Ideas as to why this could be happening?
Reply With Quote
  #2   (View Single Post)  
Old 7th November 2008
DutchDaemon's Avatar
DutchDaemon DutchDaemon is offline
Real Name: Ben
Spam Refugee
 
Join Date: Jul 2008
Location: Rotterdam, The Netherlands
Posts: 336
Default

Does the script run under the correct permissions? Does it work when you run it from root's crontab (crontab -e as the root user) instead of from the system crontab?
Reply With Quote
  #3   (View Single Post)  
Old 7th November 2008
Petrocelli08 Petrocelli08 is offline
New User
 
Join Date: Nov 2008
Posts: 7
Default Crontab won't run script

My goodness, yes that works. Well I'll be a monkey's uncle. I relaize I had to use all absolute paths though but that's fine.
Reply With Quote
  #4   (View Single Post)  
Old 7th November 2008
DutchDaemon's Avatar
DutchDaemon DutchDaemon is offline
Real Name: Ben
Spam Refugee
 
Join Date: Jul 2008
Location: Rotterdam, The Netherlands
Posts: 336
Default

Quote:
Originally Posted by Petrocelli08 View Post
I relaize I had to use all absolute paths though but that's fine.
Either that, or expand cron's path, like it's done at the top of /etc/crontab. You can do that to root's crontab just as well.

PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

This will cover most bases.
Reply With Quote
  #5   (View Single Post)  
Old 7th March 2009
marcel marcel is offline
New User
 
Join Date: Mar 2009
Posts: 1
Default

mount_smbfs with option -N tries to open $HOME/.nsmbrc for authentication.
In /etc/crontab, a non-standard HOME may be defined, disabling mount_smbfs to
find the configuration file. You could solve this by putting .nsmbrc into the HOME
directory specified in /etc/crontab, or by setting the HOME environment variable
to the directory where .nsmbrc resides from within the shell script where mount_smbfs is used.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Handy X11 script Gabe_G23 Guides 6 25th October 2008 05:08 PM
Automation Script ninjatux FreeBSD General 2 24th October 2008 04:16 PM
my 1st sh script graudeejs Programming 12 18th August 2008 10:25 PM
Crontab not working beandip FreeBSD General 6 6th August 2008 08:33 PM
Shell Script. bsdnewbie999 Programming 21 15th July 2008 07:54 AM


All times are GMT. The time now is 07:49 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick