Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2007
    Posts
    78

    Unanswered: Cron not working

    Hi everyone,

    Sorry but this might seem like a simple question but i can't get around it so any help would be greatly appreciated. I set up a crontab to have my backup script to run everyday at 13:00 so here's how it looks like:

    00 13 * * * /data/db2inst1/scripts/db2_back_ful.sh

    Here's how the script looks like:

    #! /bin/ksh
    date >> /data/db2inst1/backup/backup.log

    . /data/db2inst1/.profile

    for i in `db2 list db directory | grep "Database alias" | awk {' print $4 '}`
    do
    db2 connect to $i
    db2 QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS
    db2 connect reset
    db2 deactivate db $i
    db2 backup db $i to /data/db2inst1/backup >> /data/db2inst1/backup/backup.log
    db2 UNQUIESCE DATABASE
    done

    It doesn't run. It doesn't even executes the first line which is the date function.

    When i try to run it manually by executing: ./db2_back_ful.sh

    It's giving the following error message:

    ./db2_back_ful.sh: Permission denied.

    But when i run:
    bash ./db2_back_ful.sh it runs fine.

    I know i'm forcing it to run bash but i don't want to do that.

    OS - REHL 4.0
    DB2 V9
    Fixpack 4a

    Any help would be great. Thanks.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Which user is the cron job defined?

    Andy

  3. #3
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by rev1976
    #! /bin/ksh
    If you want bash, better change this first script line to "#! /bin/bash"; verify first that /bin/bash exists; could also be /usr/bin/bash or some other location. Or just drop that first line.
    Quote Originally Posted by rev1976
    for i in `db2 list db directory | grep "Database alias" | awk {' print $4 '}`
    Interchange single quotes and braces: ... awk '{print $4}'
    (Some shells try to interpret the "{}" themselves.)

    Quote Originally Posted by rev1976
    ./db2_back_ful.sh: Permission denied.
    Execute (once) the command "chmod a+x db2_back_ful.sh"
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  4. #4
    Join Date
    Dec 2007
    Posts
    78
    Great. I got it to work. Thanks for all your help. BUT now i'm experiencing a different problem. The cron worked the first night but when it ran the second night i'm getting the following error message:

    SQL2059W A device full warning was encountered on device
    "/data/db2inst1/backup".
    Do you want to continue(c), terminate this device only(d), abort the utility(t) ? (c/d/t) SQL2001N The utility was interrupted. The output data may be incomplete.

    When i try to run the db2 backup command manually it just hangs there. Any ideas? Thanks again.

  5. #5
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    yes, check your space. It is exactly what it is. You are out of space.
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  6. #6
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    You can also add the "WITHOUT PROMPTING" clause to the backup command so even if it errors out like this, it will not hang.

    Andy

Posting Permissions

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