LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-28-2004, 01:23 PM   #1
jillu
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11

Rep: Reputation: 0
"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
 
Old 10-28-2004, 01:37 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Try putting a descriptive echo statement above each command so that you can see if it is failing on a specific command.
 
Old 10-29-2004, 01:29 PM   #3
jillu
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11

Original Poster
Rep: Reputation: 0
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
 
Old 10-29-2004, 01:41 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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
 
Old 10-29-2004, 02:25 PM   #5
jillu
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11

Original Poster
Rep: Reputation: 0
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
 
Old 10-29-2004, 03:29 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
And it's not executable ...


Cheers,
Tink
 
Old 11-01-2004, 01:18 PM   #7
jillu
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11

Original Poster
Rep: Reputation: 0
Tinkster~

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

Jill
 
Old 11-01-2004, 01:23 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 11-01-2004, 01:36 PM   #9
jillu
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11

Original Poster
Rep: Reputation: 0
Ok Tinkster.... so, how do I make it executable then?

Jill
 
Old 11-01-2004, 01:44 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
chmod u+x /etc/cron.hourly/announce2
 
Old 11-01-2004, 06:20 PM   #11
jillu
LQ Newbie
 
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11

Original Poster
Rep: Reputation: 0
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
 
Old 11-02-2004, 01:19 PM   #12
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Does the path have spaces in it? Try surrouding it with quotes.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 04:50 AM
Submount, "permission denied" when writing to floppy as normal user DaneM Linux - Software 5 02-22-2006 02:05 PM
error "su: permission denied sorry." jacksonscottsly Linux - General 4 11-03-2003 01:47 AM
"permission denied" when I try to send raw data to the sound device. Travis86 Linux - Hardware 2 10-29-2003 09:08 AM
NTPD & "permission denied error" ghight Linux - Software 10 02-21-2003 01:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration