You are not logged in.
In my crontab, I've defined this:
* * * * * /home/ian/bin/bank_account -10.00But /var/log/crond.log says "exit status 139". The same executable works perfectly if I run it manually. Entries such as this:
* * * * * /bin/echo test >> /home/ian/docs/cron.testalso work just fine. I'm at a loss for what to try---I've made sure I've got absolute paths, I've tried redirecting stderr to a file (the file gets created, but it's empty), and the executeable has proper permissions (755). Any ideas?
Thanks.
Edit: Okay, it looks like the error 139 has to do with the stderr redirect, which is for some reason being sent to the program on stdin (i.e., the program thinks it's getting "2> /home/ian/docs/cron.test" as an argument). I think. I can't think of any other way to account for a segfault; when I don't redirect stderr, I don't get error 139.
It's a program I wrote myself. I'm guessing that's the problem---some bug in my code. Without the stderr redirect, the crond.log reports exit status 1, which I believe is EXIT_FAILURE as defined in stdlib.h and which in my code means there was an error opening a file. But those files all have the right permissions (600).
My current theory is that since I use getenv("XDG_DATA_HOME") to determine file paths, and cron doesn't run with the same environment as a bash shell, that function isn't working here. Is there a way around this other than hard-coding file paths?
Last edited by ibrunton (2012-07-11 02:26:08)
Offline
exit status 139 is likely to be a segfault (128 + signal 11). Without knowing anything about that program, it's hard to say why it's happening. Keep in mind that cron tasks run in a very reduced environment and not all variables will be present.
Offline
exit status 139 is likely to be a segfault (128 + signal 11). Without knowing anything about that program, it's hard to say why it's happening. Keep in mind that cron tasks run in a very reduced environment and not all variables will be present.
Yeah, I just clued in; see the update I just added to my original post. I think this is a case of programmer short-sightedness.
Offline
Indeed. You're hitting a null dereference when you're trying to use the return of that getenv() call. Generally if I need my scripts to be capable of running through cron, I fallback on things like $HOME/.cache for XDG_CACHE_HOME. HOME will be defined.
Offline
Indeed. You're hitting a null dereference when you're trying to use the return of that getenv() call. Generally if I need my scripts to be capable of running through cron, I fallback on things like $HOME/.cache for XDG_CACHE_HOME. HOME will be defined.
Yup, that did it, just changed the getenv() call and everything works properly now. Thanks!
Offline