cron job only runs halfway
I've got a cron.daily script that's supposed to pull a remote text file, force it all to lowercase, remove stupid windows formatting junk, and save it with the date in the filename. The job runs, but the final document is empty. When you run the script manually from the command line, it works gloriously...
Code:
# get the date, for the title I'm running on a slack 10.0 box, with bash as the shell of choice. If you need any other information, let me know. Any help would be extremely appreciated. I've been mulling over this for about three weeks so far, and I'm getting worse about forgetting to run this thing manually each morning. :P |
Quote:
EDIT: ** Please ignore. I didn't read your post carefully. ** |
Ah... that's right.
I knew it would end up being something stupid I'd overlooked. I'll fix that and we'll see if it fixes it. Thanks! |
No, I don't believe that this solves your problem. At best the redirection to /dev/null hides an error message that would have been mailed to you about the problem. I think it's a permissions problem or a PATH problem. Please check.
|
Permissions are right. I can say that much for certain. I've re-checked that countless times.
As far as the path being wrong, I don't see how that could be a problem if it runs properly when executed manually. I thought you might have a point with your post about the /dev/null bit. I thought the > in... Code:
tr -d '\15\32' < /var/log/foo/temp > /var/log/foo/temp2; At any rate, my initial tinkering didn't work because I missed a stupid little something, so the script didn't even run last night. I fixed that, and I'll see in the morning if it works this time. |
You might want to leave the temp files around to see what they contain...
I noticed you have this: # clean up the temp files rm /var/log/foo/temp; rm /var/log/foo/temp2; Comment them out and then check to make sure that /var/log/foo/temp contains what you expect it to after the script runs. Other questions... Why do you run one this way: tr -d '\15\32' < /var/log/foo/temp > /var/log/foo/temp2; and then turn around and do this? cat /var/log/foo/temp2 | tr -t '[:upper:]' '[:lower:]' > /var/log/foo/foo$dater; couldn't you do this: cat /var/log/foo/temp | tr -d '\15\32' | tr -t '[:upper:]' '[:lower:]' > /var/log/foo/foo$dater; |
Sorry about the delayed response. I've been too busy to even look into this for a couple days.
The main reason for separating them was for troubleshooting purposes, so I could look at the temp files as mentioned above, though I'll probably combine the commands as you suggested once it's... well, working. I'm going to comment out the rm's and see how that goes in the morning. Thank again for the help guys. |
Find anything?
|
Actually no.
No matter what I do, there aren't any temp files created. At least that establishes WHERE the problem lies. Just no idea why. |
Just an idea...
Change /var/log/foo/whatever to /tmp/whatever Not all users can write to the /var/log directory. |
Hmmm...
But if it didn't have permission to write the temp files, how is it still writing the dater'ed files? |
Got this working through a cron job:
Code:
# get the date, for the title |
Just as an idea, I'm going to try to have the wget write to /tmp and have the cat commands pull from there...
Code:
# get the date, for the log title |
Gah. No dice. Still creates the empty dated file.
I'm gonna tinker with this some more, but in the meantime, I'll have the log reading script execute the cron script if the dated file is empty. |
So does the /tmp/tempfile have anything in it?
|
All times are GMT -5. The time now is 12:40 AM. |