Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All, I am having issues in running a particular script from the crontab. when I run the script manually from anywhere on the prompt it is going through, but ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    14

    Issue with crontab

    Hi All,

    I am having issues in running a particular script from the crontab.

    when I run the script manually from anywhere on the prompt it is going through, but when I run the same script from crontab it is throwing errors in the /var/mail/root file.

    The output of the root file is specified below.



    From root@RS80.site Thu Dec 6 05:21:15 2007
    Return-Path: <root@RS80.site>
    X-Original-To: root
    Delivered-To: root@RS80.site
    Received: by RS80.site (Postfix, from userid 0)
    id 3D96E20BFC; Thu, 6 Dec 2007 05:21:15 -0500 (EST)
    From: root@RS80.site (Cron Daemon)
    To: root@RS80.site
    Subject: Cron <root@RS80> sh /usr/scripts/es_pgsqlBuild.sh
    X-Cron-Env: <SHELL=/bin/sh>
    X-Cron-Env: <PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin:/var/lib/pgsql/data:/home/DTEDIT/new_build>
    X-Cron-Env: <MAILTO=root>
    X-Cron-Env: <HOME=/root>
    X-Cron-Env: <LOGNAME=root>
    Message-Id: <20071206102115.3D96E20BFC@RS80.site>
    Date: Thu, 6 Dec 2007 05:21:15 -0500 (EST)

    Branch: HEAD
    All stages succeeded
    CHECKING PARAMETERS
    PRIMARY DATABASEgDb_primary SECONDARY DATABASEgDb_secondary NUMWAREHOUSE:1
    could not change directory to "/root"
    DROP AND CREATE PRIMARY DATABASE: pgDb_primary
    /usr/scripts/es_pgSQLbuildTest.sh: line 129: /bin/java: No such file or directory
    /usr/scripts/es_pgSQLbuildTest.sh: line 137: /bin/java: No such file or directory
    /usr/scripts/es_pgSQLbuildTest.sh: line 145: /bin/java: No such file or directory

    DROP & CREATE SECONDARY DATABASE: pgDb_secondary
    cvs.log is existing
    check.log is existing
    config.log is existing
    configure.log is existing
    contrib-install-check.log is existing
    ecpg-check.log is existing
    initdb.log is existing
    installcheck.log is existing
    installcontrib.log is existing
    makecontrib.log is existing
    makeinstall.log is existing
    make.log is existing
    plinstallcheck.log is existing
    startdb1.log is existing
    startdb2.log is existing
    startdb3.log is existing
    stopdb1.log is existing
    stopdb2.log is existing
    stopdb3.log is existing
    web-txn.data is existing
    All logfiles have been accumulated and the new logfile runBuild_log_12062007_0501.log has been successfully generated


    If you will see in the above output the text in red is the error message that I am encountering, this messahe I am not getting while I am running the script from the prompt.



    The first error is encounteerd when this command is executed from the script



    /bin/cat /root/softwares/BenchmarkSQL-2.3.2/run/postgres.properties | /usr/bin/sed -e 's/'$varpostprop'/'$varpostconf'/'>/root/softwares/BenchmarkSQL-2.3.2/1.log ;

    /bin/mv /root/softwares/BenchmarkSQL-2.3.2/1.log /root/softwares/BenchmarkSQL-2.3.2/run/postgres.properties



    The other error messages are encountered while sxecuting the following commands





    #CREATE BASE TABLE IN PRIMARY DATABASE



    "$JAVA_HOME/bin/java" -cp ../lib/edb-jdbc14-8_0_3_14.jar:../lib/ojdbc14-10.2.jar:../lib/postgresql-8.0.309.jdbc3.jar:../dist/BenchmarkSQL-2.3.jar -Dprop=postgres.properties

    -DcommandFile=sqlTableCreates ExecJDBC>>/home/DTEDIT/Buildtest_logs/pgsqlBuild/"es_pgDbCheck"_"$DT".log



    #POPULATE THE DATABASE



    "$JAVA_HOME/bin/java" -cp ../lib/edb-jdbc14-8_0_3_14.jar:../lib/ojdbc14-10.2.jar:../lib/postgresql-8.0.309.jdbc3.jar:../dist/BenchmarkSQL-2.3.jar -Dprop=postgres.properties

    LoadData numWarehouses $varwarehouse>>/home/DTEDIT/Buildtest_logs/pgsqlBuild/"es_pgDbCheck"_"$DT".log



    #CREATE INDEX



    "$JAVA_HOME/bin/java" -cp ../lib/edb-jdbc14-8_0_3_14.jar:../lib/ojdbc14-10.2.jar:../lib/postgresql-8.0.309.jdbc3.jar:../dist/BenchmarkSQL-2.3.jar -Dprop=postgres.properties

    -DcommandFile=sqlIndexCreates ExecJDBC>>/home/DTEDIT/Buildtest_logs/pgsqlBuild/"es_pgDbCheck"_"$DT".log






    It would be very helpful if anyone could help me with this issue of crontab, if you would require any other details please revert back to me.



    Thanks in advance

    Regards

    Cinu Kuriakose

  2. #2
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    could not change directory to "/root"

    Is it a Crontab under Roots account or under the users account?

    Cheers,
    Robin
    New Users, please read this..
    Google first, then ask..

  3. #3
    Just Joined!
    Join Date
    Oct 2007
    Posts
    14
    It is under the Roots account

  4. #4
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    Can you do:
    Code:
    ls -al /
    Code:
    ls -al /root
    and add:
    Code:
    echo "Hello I am: $UID - $USER"
    to the Crontab script?

    Post all output here.

    Cheers,
    Robin
    New Users, please read this..
    Google first, then ask..

Posting Permissions

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