"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 |
Try putting a descriptive echo statement above each command so that you can see if it is failing on a specific command.
|
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 |
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 |
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 |
And it's not executable ...
Cheers, Tink |
Tinkster~
Ok, I'll bite... Why do you say "it's not executable"?? Jill |
Quote:
Quote:
Code:
-rwxr--r-- 1 root root 301 Oct 27 15:10 /etc/cron.hourly/announce2 Cheers, Tink |
Ok Tinkster.... so, how do I make it executable then?
Jill |
chmod u+x /etc/cron.hourly/announce2
|
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 |
Does the path have spaces in it? Try surrouding it with quotes.
|
All times are GMT -5. The time now is 04:01 AM. |