Script runs in shell but not cron

We run some menu driven software that has the ability to batch menu paths and generate reports quickly. Normally you run a batch like:

$ BATCH BATCHNAME

The batch program then prompts you for the date you want the report run for. I got some help from some folks on IRC to do the following:

BATCH BATCHNAME $(date +%y%d%m)

This allowed me to run the batch using the current date without having to enter the date at the prompt (it auto-fills the prompt in effect). It runs fine from the $ (ksh) and it runs fine from a script (sh something). However, when I try to run it with cron it errors out with invalid date. I have tried calling the script from cron AND running the straight BATCH command from cron (both methods listed above). Why wont cron let me feed the above date variable to my batch program?

You are probably falling for Cron Problem Number One.

I hope this helps.

bakunin

1 Like

checking the users in smit, i am seeing that cron user has the same home directory and all the same settings as MY username. and no, i did not make it that way.

SOLVED. that was the ticket bakunin. I had been messing around with env stuff in my script already with no luck. then i tried

TERM=ansi

and that got it.

Thanks!