AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  Crontab Job is not runing

    Posted Fri September 12, 2014 08:42 AM

    Originally posted by: AshishKumarMahanta


    Dear All,

    Our server's profile is as below -

    
    
    PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/lbin:/oracledb/app/oracle/OraHome_1/bin:.
    
    export PATH
    
    if [ -s "$MAIL" ]           # This is at Shell startup.  In normal
    then echo "$MAILMSG"        # operation, the Shell checks
    fi                          # periodically.
    #echo "executing this profile stage 9"
    #DISPLAY=192.168.0.152:0; export DISPLAY
    echo "executing this profile stage 0"
    AIXTHREAD_SCOPE=S; export AIXTHREAD_SCOPE
    TEMP=/tmp
    TMPDIR=/tmp
    export TEMP TMPDIR
    #echo "executing this profile stage 1"
    ORACLE_BASE=/oracledb/app/oracle; export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/OraHome_1; export ORACLE_HOME
    LIB_PATH=$ORACLE_HOME/lib; export LIB_PATH
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib
    export LD_LIBRARY_PATH
    ORACLE_SID=FIJIPROD
    export ORACLE_SID
    #unset ORACLE_HOME
    #unset TNS_ADMIN
    export AIXTHREAD_SCOPE=S
    umask 022
    

    An my backup script is as below-

     

    
    
    PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/lbin:/oracledb/app/oracle/OraHome_1/bin:.
    export PATH
    ORACLE_BASE=/oracledb/app/oracle; export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/OraHome_1; export ORACLE_HOME
    LIB_PATH=$ORACLE_HOME/lib; export LIB_PATH
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib
    export LD_LIBRARY_PATH
    ORACLE_SID=FIJIPROD
    export ORACLE_SID
    export DMP_DEST=/oracledb1/DP_DIR_FIJIPROD
    export DMP_RETENTION=3
    expdp system/oracle directory=DP_DIR dumpfile=expdp_`date +%d%m%y_%H_%M`_$ORACLE_SID.dmp LOGFILE=expdp_`date +%d%m%y_%H_%M`_$ORACLE_SID.log full=y  exclude=statistics
    ###############gzip####################
    gzip $DMP_DEST/*.dmp
    ##########################################deleted#######################################
    echo "Cleaning up 1 week old backupfiles/logfiles ..." 
    find $DMP_DEST -name '*.log' -mtime +$DMP_RETENTION -exec ls -l {} \;
    find $DMP_DEST -name '*.log' -mtime +$DMP_RETENTION -exec rm -r {} \;
    find $DMP_DEST -name '*.gz' -mtime +$DMP_RETENTION -exec ls -l {} \;
    find $DMP_DEST -name '*.gz' -mtime +$DMP_RETENTION -exec rm -r {} \;
    echo "cleaning completed.."
    

     

    When, initiating backup script manually, it's running. But when i scheduled it at crontab, job is not running.

    Please suggest, what could be the reason? Assist me to resolve the issue.

    Regards,

    Ashish Kumar Mahanta

     


    #AIX-Forum


  • 2.  Re: Crontab Job is not runing

    Posted Fri September 12, 2014 11:29 AM

    Originally posted by: JoachimB


    Write the messages created by your cronjob to a file; the file may give you a clue where the job fails.


    #AIX-Forum


  • 3.  Re: Crontab Job is not runing

    Posted Mon September 15, 2014 08:33 AM

    Originally posted by: Wouter Liefting


    Agree. Furthermore, you may want to run the "set" and/or "env" command at the start of your script, both when you run the script manually and from cron. There are subtle differences between these environments and one of those differences may cause your script to fail.


    #AIX-Forum