3 Replies Latest reply: Apr 26, 2014 1:29 AM by yoonas RSS

    crontab

    Abhishek12991

      This is my shell script.when i run this in a terminal ,its working fine......

      but through crontab its not working.......please give solution

      crontab -e

       

      SHELL=/bin/bash
      PATH=/sbin:/bin:/usr/sbin:/usr/bin
      MAILTO=oracle
      HOME=/
      21 17 25 04 5 /home/srl/backup.sh

       

       

      backup.sh

      #/bin/bash
      ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
      export ORACLE_HOME
      export PATH=$ORACLE_HOME/bin:$PATH
      ORACLE_SID=orcl; export ORACLE_SID
      #Date Format
      DATE=$(date +"%d-%m-%Y")
      NOW=$(date +"%d-%m-%Y"-"%T")
      # Taking export of the database

      exp vdb/vdb file=/home/srl/Desktop/vdb_db_$DATE.dmp

      cd /home/srl/Desktop
      # Zip the db

      zip -r vdb_db_$DATE.zip vdb_db_$DATE.dmp

      #Remove .dmp file

      rm *.dmp

      #Create log file
      echo "Backup created on $NOW" > Backup_Log.txt

      echo "....."
      echo "....."
      echo "....."
      echo "BACKUP SUCCESSFULLY CREATED"
      exit