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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
10-28-2004, 01:23 PM
|
#1
|
|
LQ Newbie
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11
Rep:
|
"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
|
|
|
|
10-28-2004, 01:37 PM
|
#2
|
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Try putting a descriptive echo statement above each command so that you can see if it is failing on a specific command.
|
|
|
|
10-29-2004, 01:29 PM
|
#3
|
|
LQ Newbie
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11
Original Poster
Rep:
|
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
|
|
|
|
10-29-2004, 01:41 PM
|
#4
|
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
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
|
|
|
|
10-29-2004, 02:25 PM
|
#5
|
|
LQ Newbie
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11
Original Poster
Rep:
|
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
|
|
|
|
10-29-2004, 03:29 PM
|
#6
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,902
|
And it's not executable ...
Cheers,
Tink
|
|
|
|
11-01-2004, 01:18 PM
|
#7
|
|
LQ Newbie
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11
Original Poster
Rep:
|
Tinkster~
Ok, I'll bite... Why do you say "it's not executable"??
Jill
|
|
|
|
11-01-2004, 01:23 PM
|
#8
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,902
|
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
|
|
|
|
11-01-2004, 01:36 PM
|
#9
|
|
LQ Newbie
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11
Original Poster
Rep:
|
Ok Tinkster.... so, how do I make it executable then?
Jill
|
|
|
|
11-01-2004, 01:44 PM
|
#10
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,902
|
chmod u+x /etc/cron.hourly/announce2
|
|
|
|
11-01-2004, 06:20 PM
|
#11
|
|
LQ Newbie
Registered: Sep 2004
Location: Oregon
Distribution: RedHat, Mandrake, and Debian
Posts: 11
Original Poster
Rep:
|
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
|
|
|
|
11-02-2004, 01:19 PM
|
#12
|
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Does the path have spaces in it? Try surrouding it with quotes.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:01 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|