Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2009
    Posts
    28

    Post Unanswered: informix and aix script

    Dear sir
    I am trying to implement a daily task that would permit me to extract by dbaccess in my informix database a records from several remote aix server and a script .sh would copy results from the remote to my server. All this have to be executed daily by a crontab in my aix server. When I am testing the scripts all is okay buy at the time that crontab has to execute the script i have in my error log file a message "/home/ope_for.sh: dbaccess: not found".
    note: /home is the path where the script .sh is located, ope_for is my script
    my script contain this line: dbaccess base ope_for_new (where my base is my database, and ope_for_new is my sql query)

    How to resolve this issue?

  2. #2
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    248
    If the script is initiated by the crontab of an Informix user (with the appropriate rights and settings) you forgot to set the Informix environment variables explicitly in the script. A crontab job is namely started without the environment variables that are common for a loginshell of the user.

    Regards,
    Hans

  3. #3
    Join Date
    Dec 2009
    Posts
    28

    Post crontab environment

    Dear Sir
    I pleased you to tell me which are crontab variables environment to be set up in my script so that i have right result.
    This is my crontab:
    30 16 * * * /home/ope_for.sh "everyday at 4'30mn the crontab launch the script ope_for.sh which it self launch dbaccess my_database and execute the query ope_for_new
    Thanks

  4. #4
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    248
    The envvars have nothing to do with crontab but everythingh with the Informix environment. Check out which way a loginshell of the user for whom crontab is configured receives it's Informix envvars upon initiation. Usually it's done somewhere in the .profile or somewhere else in the shell init procedure by sourcing another scriptfile with a line like this
    Code:
    . /opt/informix/../..
    The sourcefile can have any name so check out every file that's sourced with the dot operator at the beginning of the line.

    It's also possible that the variables are set manually in the .profile itself. In any case the INFORMIXDIR, INFORMIXSERVER and ONCONFIG variables should be set.

    Regards,
    Hans

  5. #5
    Join Date
    Dec 2009
    Posts
    28

    next step2

    Dear Sir
    I am little confuse about the location of the envvars on informix in .profile. Please i want to know where and how to set these informix environment INFORMIXDIR, INFORMIXSERVER and ONCONFIG. Look this syntax
    INFORMIXDIR=/informix
    INFORMIXSERVER= the_name_of_server
    ONCONFIG ????
    thanks

  6. #6
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    248
    Set in the script that's run by crontab the necessary variables for connecting with the Informix engine. In my situation these variables are set in a file that's sourced into the .profile of Informix users and also into the DB scripts run by crontabs. For our IDS 10.00.UC6E these variables are:
    Code:
    export INFORMIXDIR="..."                      
    export PATH="${PATH}:${INFORMIXDIR}/bin"                           
    export ONCONFIG="onconfig.$(hostname)"                            
    export INFORMIXTERM="terminfo"                                     
    export INFORMIXSERVER="..."                                
    export LD_LIBRARY_PATH="${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql"
    export DBDATE=DMY4-                                                
    export DBEDIT=vim
    You can check the settings of these variables on your own system by performing
    Code:
    set | grep variablename
    on the commandline of an Informix user shell.

    Regards,
    Hans

  7. #7
    Join Date
    Dec 2009
    Posts
    28

    Post step 3

    Dear sir
    I just try to set up envionment variables as follow
    export INFORMIXDIR=/home/informix
    export INFORMIXSERVER=server_live
    export DBDATE=dmy4/
    export DBEDIT=vi
    dbaccess server_live ope_for
    but i am still having an error message in the error log file
    /home/ope_for.sh[5]: dbaccess: not found.
    The fact i am not understanding is that when I launch the the script on command line i have no problem but i want the system to do it because I need to do it a dozen every 6 hours.
    Thanks for your contribution

  8. #8
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    248
    That's what I said: when a shell is started through crontab the regular environment variables aren't loaded so you have tot do that manually.
    Try to find the location of the dbaccess program with:
    Code:
    $ which dbaccess
    This should be in $INFORMIXDIR/bin. The $INFORMIXDIR value is decided during server installation and is usually NOT /home/informix! Check the environment of your interactive shell!!!
    Then append this directory to the PATH variable with:
    Code:
    export PATH="${PATH}:${INFORMIXDIR}/bin"
    Write this in the script that's executed by crontab.

    Regards
    Last edited by Tyveleyn; 12-15-09 at 07:22.

  9. #9
    Join Date
    Dec 2009
    Posts
    28
    Dear sir
    I correct the script contain by providing the export PATH and now i have this error message:
    329: Database not found or no system permission.

    20: Not a directory

  10. #10
    Join Date
    Dec 2009
    Posts
    28

    merry christmas

    Hi Tyveleyn
    I am still have problem to execute my query inside a crontab even after setting environment variable. Now the error message is
    329: Database not found or no system permission.

    20: Not a directory

    Thanks

  11. #11
    Join Date
    Nov 2004
    Posts
    60
    It looks like you are trying to connect to a database that either locally is not known, or remotely does not have permissions for your user.

    Locally you must define the remote hostname in DNS (or the local /etc/hosts file) and also the remote instance in the sqlhosts file. Test this by trying to connect to the remote instance using dbaccess.

    Remotely the username you are connecting as must exist, and be trusted in the database with connect, select etc. permissions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •