I have a small shell script program which need to access a table in informix database. Therefore I inserted a dbaccess (some simple select statement) command in the program. Whenever I execute the program from unix command prompt. it manage to access the table and retrieve the value I wanted.
However when I configure the program to run a cron job, it failed to retrieve the value and just quit. I'm not sure why it is behaving like this. FYI, I have granted my login user to RESOURCE rights. I would appreciate if you can assist me. Thanks in advance.
setup the environment variables in the script. When cron is executed, it needs the environment setup for the shell it spawns. Since you have your env setup while you execute in the command line, it runs fine.
the first few line of the script could be something like this....
<home-directory of the user>/.profile
Well, I tried to put .profile at the calling program and it didn't work out. So alternately I add the informix environment at the beginning of the program and it just worked. You can add the lines as suggested by Gurey. Hope you find it useful.