LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "permission denied" error when cron job executes (http://www.linuxquestions.org/questions/linux-newbie-8/permission-denied-error-when-cron-job-executes-248435/)

jillu 10-28-2004 01:23 PM

"permission denied" error when cron job executes
 
All~

Go easy...I'm wicked new to this and yes I rtfm/how-to/etc.

I'm running this script in cron.hourly (naturally the names/etc have been changed to protect my job....)

#!/bin/bash

###let's log into the Novell server and copy some files###
ncpmount -S "SERVERNAME" -V "VOLUME" -m -U linux.adm.### -P "passwd" /mnt/servername

cp /mnt/####/DATA/APPS/Web/###site/##/daily/daily.pdf /var/www/html/##/daily/
cp /mnt/####/DATA/APPS/Web/###site/##/daily/daily.pdf /var/www/html/##/daily/

umount /mnt/"servername"

and when it executes, I get a "permission denied" error. Now, when I do all of this on the command line, it executes just fine... I've chmod'ed the file to be sure it's run as root....

Any ideas on how/what I'm missing here?

Thanks!
Jill

david_ross 10-28-2004 01:37 PM

Try putting a descriptive echo statement above each command so that you can see if it is failing on a specific command.

jillu 10-29-2004 01:29 PM

David~

Unfortunately, putting descriptive echo statements in didn't yield any insights into why this script is having problems....

Thanks for the idea tho'!!

I'm still at a loss as to why it dosen't work, I have other scripts running that basically follow the same format and they fire off just fine.

Jill

david_ross 10-29-2004 01:41 PM

Well if you didn't get any echo statements then the script itself is failing. Can you post the output of:
ls -l /path/to/script

Have you tried running it with:
bash /path/to/script

jillu 10-29-2004 02:25 PM

Here's the output from ls -l /path/to/script:


-rw-r--r-- 1 root root 301 Oct 27 15:10 /etc/cron.hourly/announce2

Tinkster 10-29-2004 03:29 PM

And it's not executable ...


Cheers,
Tink

jillu 11-01-2004 01:18 PM

Tinkster~

Ok, I'll bite... Why do you say "it's not executable"??

Jill

Tinkster 11-01-2004 01:23 PM

Quote:

Why do you say "it's not executable"??
Quote:

-rw-r--r-- 1 root root 301 Oct 27 15:10 /etc/cron.hourly/announce2
because it's not executable... it should say
Code:

-rwxr--r-- 1 root root 301 Oct 27 15:10 /etc/cron.hourly/announce2

Cheers,
Tink

jillu 11-01-2004 01:36 PM

Ok Tinkster.... so, how do I make it executable then?

Jill

Tinkster 11-01-2004 01:44 PM

chmod u+x /etc/cron.hourly/announce2

jillu 11-01-2004 06:20 PM

Tinkster~

Thanks for the help... Now that it's executable, I am getting this:

./announce2.cron: line 7: cd: /: No such file or directory
./announce2.cron: line 8: cd: /APPS: No such file or directory
./announce2.cron: line 9: cd: /Web: No such file or directory
./announce2.cron: line 10: cd: /site/: No such file or directory
cp: cannot stat `/mnt/"server"/"volume"/APPS/Web/site/xx/daily/xx.pdf': No such file or directory
cp: cannot stat `/mnt/"server"/"volume"/APPS/Web/site/xx/daily/xx.pdf': No such file or directory

I did make one change to the file:

I added:
cd /DATA
cd /APPS
cd /Web
cd /BSDsite/

to see if I would get an error msg about each directory ....

When I check my mounted devices, the proper Novell directory /mnt/"server"/ appears... Why won't the script change to the correct directory to copy the files?

Jill

david_ross 11-02-2004 01:19 PM

Does the path have spaces in it? Try surrouding it with quotes.


All times are GMT -5. The time now is 12:29 PM.