![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() |
Weird .Cron Error (Too lazy to sign up for a Linux forum)
Too lazy to sign up for a Linux forum...
I'm having a weird issue with cron. The file looks something like: MAILTO=thisismyaddress 0 0 * * * /home/skiclub/sync/esus -u When the cron job executes, I get an e-mail indicating that the program esus (which I believe is Java...) started executing... but ran into a permissions error when it attempted to delete/modify a file. However... if I run the command "/home/skiclub/sync/esus -u" in the same shell, of the same Unix user account, it runs through fine without the permission error. Why does my cron's shell command have less privileges than the same user's shell command? Doesn't the crontab execute the command just as if it were typed into the shell?? Perhaps the permission error is related to the lack of an included resource? Do I need to specify anything in PATH or SHELL or HOME? ![]() |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Jun 2007
Posts: 133
Rep Power: 2
![]() |
Re: Weird .Cron Error (Too lazy to sign up for a Linux forum)
what file is it trying to delete/modify? you might need to chmod the file to be writable...
|
|
|
|
|
|
#3 |
|
Expert Programmer
|
Re: Weird .Cron Error (Too lazy to sign up for a Linux forum)
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() |
Re: Weird .Cron Error (Too lazy to sign up for a Linux forum)
titanium: If that runs the file under the user root, I don't want that. The program creates files that need to have specific permissions and owner. And I can't shouldn't be modifying the code to change the owner or chmod the files.
Therefore I need it to run the file using the current user... the user who owns the crontab. But I still don't understand!! Does cron not execute the shell command as if it were typed into the shell by the owner of the crontab? Why does it work if I type it in directly, but not in cron!? That's so frustrating. I'm reading information about PATH. But I don't understand it. Might there be a path variable that Java needs? How can I check? Why would this matter anyways if it already works in the shell? |
|
|
|
|
|
#5 |
|
Expert Programmer
|
Re: Weird .Cron Error (Too lazy to sign up for a Linux forum)
Replace root with the username of the user you want the cron to run as.
If you post the error message your Java program is giving you I might be able to help. Also, what linux distro and shell are you using? |
|
|
|
|
|
#6 |
|
Programming Guru
![]() |
Re: Weird .Cron Error (Too lazy to sign up for a Linux forum)
I'm X11ing into Redhat 4.
The error message is the permissions error when it tries to delete/modify. So by default, what username does a cron run under? As far as I can tell, it has been running under the crontab's user, as it has been for my other cron jobs... which is what I need for this cron job too... so I'm pretty sure it's got the user right. But that would be the same user that it works as a shell command with! |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: Jun 2007
Posts: 133
Rep Power: 2
![]() |
Re: Weird .Cron Error (Too lazy to sign up for a Linux forum)
you're not using cron tabs properly, read this: http://www.cyberciti.biz/faq/how-do-...-or-unix-oses/
|
|
|
|
|
|
#8 |
|
Programming Guru
![]() |
Re: Weird .Cron Error (Too lazy to sign up for a Linux forum)
How is
5 0 * * * /path/to/command Any different from 0 0 * * * /home/skiclub/sync/esus -u ... ... |
|
|
|
|
|
#9 |
|
Programmer
|
Re: Weird .Cron Error (Too lazy to sign up for a Linux forum)
Is Java in PATH and is esus executable?
What exactly is the error message? and is the Esus program compiled or is it a script? You could try throwing in a few statements for debugging. |
|
|
|
|
|
#10 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Weird .Cron Error (Too lazy to sign up for a Linux forum)
The OP has stated that the program (esus) runs properly from the command line. He has stated that the error has to do with permissions being violated when he attempts to modify or delete a file. I think that indicates that esus is executable. I don't know why he would want to add debugging statements to it.
Whether or not there's a path difference that has implications when it's run from the command line, versus when cron runs it, I don't know. I don't have a Linux system, either. Some of the responses are pretty damned silly, though, given the previous information in the thread.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Slackware installation guide for Linux beginners | coldDeath | Coder's Corner Lounge | 104 | Jul 29th, 2007 4:40 AM |
| How many forum members... | DaWei | Coder's Corner Lounge | 33 | Jul 17th, 2007 4:55 PM |
| My views on Linux | Marvin | Coder's Corner Lounge | 70 | Dec 19th, 2006 11:13 AM |
| Linux is Annoying (Ubuntu) | Baphomet | Coder's Corner Lounge | 6 | Dec 1st, 2006 8:42 AM |
| windows memset and Linux memset (difference?) | Dr.Backtick` | C++ | 0 | Feb 5th, 2005 7:59 PM |