|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Crontab and (permission denied)
Hello all,
Im trying to schedule a java program to run a few times daily with crontab on UNIX. The program will run and produce the correct output(i know because it emails the output to me), but whenever I try to append the output in an existing text file, i get an error that looks like : java.io.FileNotFoundException: /usr/local/home/myid/public_html/Forecast/file.txt (Permission denied) I tried to change the permission of file.txt to always use my id (or something like this...i read it online and attempted it but I did not have the permission to change to it). Any ideas? |
|
#2
|
||||
|
||||
|
if you don't own the file and you don't have the permissions to modify it's ownership, then you're stuck - so why not just create a new file somewhere, then use chmod to set the permissions you want.
christo
__________________
. Spiration channels: Free scripts, programming tutorials and articles Dotcut alerts: Online Press cuttings / news alerts Clearprop: UK microlight school, wiltshire Uk dating: UK safe dating with Topdates About Christo . . |
|
#3
|
|||
|
|||
|
I own it
Thats the thing, I do own the file, i created it, its in a directory of mine, and I can change its permissions - until i tried to change them to whatever i was reading about suid or something, and it said i didnt have permission to do that...lets assume for now I have all permissions to do what i want to the file...why from crontab is the permission denied?
|
|
#4
|
||||
|
||||
|
can the java app write to the file when you run it standalone without crontab? Which user's crontab file did you put the crontab entry into? Was it yours or somebody else's? Remember the cron will run with the permissions of the script owner.
christo |
|
#5
|
|||
|
|||
|
yes, the java app can write to the file standalone. And the crontab is my crontab file.
|
|
#6
|
||||
|
||||
|
hmmm - can you post back the result of
$ ls -al file-you-are-writing-to.txt and $ ls -al java-binary-in-question.class and $ cat /var/spool/cron/crontabs/yourusername christo |
|
#7
|
|||
|
|||
|
-rw-r--r-- 1 porterfi compsci 114 Nov 22 15:41 data.txt
-rwx--x--x 1 porterfi compsci 4998 Nov 22 14:34GetData.class* cat: /var/spool/cron/crontabs/porterfi: Permission denied |
|
#8
|
||||
|
||||
|
okay and try this too:
$ ls -al /var/spool/cron/crontabs/* and $ crontab -l and $whoami and post the results, christo |
|
#9
|
|||
|
|||
|
ls: No match.
* 0 * * 1-7 cd /usr/local/home/porterfi/public_html/Forecast; java GetData porterfi |
|
#10
|
||||
|
||||
|
Quote:
does this work if you just do it like this: * 0 * * 1-7 java /usr/local/home/porterfi/public_html/Forecast/GetData christo |
|
#11
|
|||
|
|||
|
no, that does not work. I cannot even run java /usr/local/home/porterfi/public_html/Forecast/GetData
from my command line. But i know with the other way, it does work, because the java program outputs to stdout and to the file the same thing, and I get in my 'output email' from crontab the correct output, followed by the error that the i couldnt touch the file cause my permission is denied... |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Crontab and (permission denied) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|