Scheduling issues


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Scheduling issues
# 1  
Old 07-23-2013
Scheduling issues

I AM ON SOLARIS

I have a script it.sh which is running fine when i execute it from shell command.
But when i schedule it in crontab it is throwing error.

Why and how can i resolve it ?i am clueless

IT.SH
Code:
#!/bin/sh
ORACLE_HOME=/var/opt/oracle/product/10g; export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin:/bin:/usr/bin; export PATH
today=`date "+%m-%d-%Y  %H:%M:%S"`; export today
CUR_DIR=$1; export CUR_DIR


LOG_FILE=$CUR_DIR/error.log; export LOG_FILE

# Direct script output to log
exec > $LOG_FILE 2>&1

echo
echo
echo "LOGGING STARTS $today"
echo
echo
###Fetching the script directory from configuration file 
SCRIPT_DIR=`cat $CUR_DIR/.id_pass_file.txt | grep "^SCRIPT_DIR" | cut -d "=" -f2`; export SCRIPT_DIR

### Credentials for SQLPLUS

USER_ID=`cat $CUR_DIR/.id_pass_file.txt | grep "^USER_ID" | cut -d "=" -f2`; export USER_ID
PWD=`cat $CUR_DIR/.id_pass_file.txt | grep "^PWD" | cut -d "=" -f2`; export PWD
SID=`cat $CUR_DIR/.id_pass_file.txt | grep "^SID" | cut -d "=" -f2`; export SID


### Connecting ORACLE

echo "SQLPLUS CONNECTION"

sqlplus -s $USER_ID@$SID/$PWD<<EOF>$CUR_DIR/sql_output.txt
set feedback off
set heading off
select distinct account_no from adj  WHERE ADJ_TRANS_CODE=-2401  and request_status=1  and bill_ref_no=0
order by account_no;
EOF


if [ $? -eq 0 ] 
then 
echo " SQLPLUS Connection Successful "
else
echo " SQLPLUS Connection Failed "
fi

##echo " The account numbers to be used in BIP are  "



if [  ! -s  "$CUR_DIR/sql_output.txt" ]
then
echo "No account number for bad debt" 
else
for i in `cat $CUR_DIR/sql_output.txt`
do
echo "bip $i is running"
sh  $SCRIPT_DIR/bip.sh 01 0 $i >  $CUR_DIR/bip_log_1.txt
sleep 180
done
fi

My error is in error.log
Code:
LOGGING STARTS


SQLPLUS CONNECTION
 SQLPLUS Connection Successful
bip 114034 is running
cat: cannot open /.arborpw

my error is bip_log_1.txt
Code:
ERROR: $ARBORDBU environment variable is not set

This script requires that the $ARBORDBU environment variable be set.


My bip.sh is
Code:
#!/bin/sh
ARBOR_DB_PASSWD=`cat $ARBORDIR/.arborpw`; export ARBOR_DB_PASSWD
DB_PASS=$ARBOR_DB_PASSWD; export DB_PASS;
ORACLE_SID=$ARBOR_CATALOG_DATABASE; export ORACLE_SID;
ARBORCTRLRPT03=$ARBORDATA/reports/ctrl; export ARBORCTRLRPT03;

Usage(){
  echo "\n\n  Usage is: `basename $0` <proc_num> <bip mode> <account_no>\n"
  echo "  where <proc_num> is a number between 01 and 99"
  echo "        <bip_mode> is a number. Use 0=production, 3=proforma, 6=backout"
  echo "        <bip_mode> is an arbor accout number\n\n"
  exit 0
}

#  Check number of arguments
if [ "$#" -ne 3 ] ; then
  Usage
fi

# Check to see if ARBORDBU is set
if [ -z "${ARBORDBU}" ] ; then
        echo "ERROR: \$ARBORDBU environment variable is not set\n"
        echo "This script requires that the \$ARBORDBU environment variable be set.\n\n"
        exit 1
fi

# Check to see if DB_PASS is set
if [ -z "${DB_PASS}" ] ; then
        echo "ERROR: \$DB_PASS environment variable is not set\n"
        echo "This script requires that the \$DB_PASS environment variable be set.\n\n"
        exit 1
fi

# Check to see if ORACLE_SID is set
if [ -z "${ORACLE_SID}" ] ; then
        echo "ERROR: \$ORACLE_SID environment variable is not set\n"
        echo "This script requires that the \$ORACLE_SID environment variable be set.\n\n"
        exit 1
fi

# Set the variables for arguments passed by the user
PROCNAME=bip$1
BIP_MODE=$2
ACCOUNT=$3

# Get the database from the user's environment
DB=$ORACLE_SID

# Set this so that the process doesn't try to connect to Operations Center
OAM_ENV_CONN_MA=FALSE
export OAM_ENV_CONN_MA


# Log into sqlplus, delete any existing entries, and make the new entry
sqlplus -s $ARBORDBU/$DB_PASS@$DB <<END

update SYSTEM_PARAMETERS set int_value=1 where module='BIP' and parameter_name='TRA_SWITCH';
delete from PROCESS_SCHED where process_name = '$PROCNAME';
delete from PROCESS_STATUS where process_name = '$PROCNAME';
insert into PROCESS_SCHED values('$PROCNAME','$PROCNAME','N',$BIP_MODE,SYSDATE,86400,0,2,55,'$DB','CMF.account_no in ($ACCOUNT)',1,NULL,0,NULL,0);
commit;
exit

END

echo "Starting BIP in the background with process name = \"$PROCNAME\""
BIP $PROCNAME 3 &

# 2  
Old 07-23-2013
We've been through this, and you're obviously not learning anything. Please try to analyse the problem yourself before posting AGAIN the same question. Closed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Crontab Scheduling

I want to schedule a job as - Every Weekday at 12:30 PM and 9 PM in a single line. How can i do that (2 Replies)
Discussion started by: varlax
2 Replies

2. Shell Programming and Scripting

Scheduling scheduling !!!

Hi, i have 10 sh scripts. All are running in parallel using cron tab and each script gives "success" flag files once the execution is completed. and, now i have 11th script which should look for "success" flag from those 10 sh scripts. once all the 10 flag files found, 11 th script has to do... (9 Replies)
Discussion started by: nago123
9 Replies

3. Linux

Help with cronjob scheduling

Hi Everybody, How to schedule a job using cron that shouldn't run between working hrs 9am-5pm, while run in non working hrs every hour, every day of the month, month & week. I tried the following way, not sure I can use logical not operator(!). Please correct me if wrong or suggest other... (2 Replies)
Discussion started by: sudhirav
2 Replies

4. HP-UX

cron scheduling?

Hi all, i want a job to run first monday of every of month. (1 Reply)
Discussion started by: megh
1 Replies

5. UNIX for Dummies Questions & Answers

Scheduling login

Hi. I would like to know if there is any method to schedule logins for a user. I want the user x to login automatic if system is booted up in a particular range of time. I want proper login with passwords at other times. The scenario is that the system has be scheduled for automatic booting... (1 Reply)
Discussion started by: Vivek788
1 Replies

6. HP-UX

HP-UX Scheduling Algorityms

From my reading HP-UX uses 4 different CPU scheduling algorithms: HP-UX Time-Share, HP Process Resource Manager, HP-UX Real-Time Scheduler, and POSIX-Compliant Real-Time Scheduler. Here is where I am getting a little lost. Each algorithm seems to have its own priority, one higher than the... (1 Reply)
Discussion started by: Mr_Roboto
1 Replies

7. Shell Programming and Scripting

script scheduling

Hi, I have a ksh scrip (x) that scans a directory and does actions when a file arrives in this directory. My question is what is the best way to schedule x? 1. Use cron tab and create a task running forever 2. Creat another ksh script (y) that runs (x) in a non-terminating loop Which... (2 Replies)
Discussion started by: GNMIKE
2 Replies

8. Programming

scheduling a process

hi there i m having a confusion here with the looping in this example below. can someone help me out!? #include<stdio.h> main() { char it = 'a'; char stop = 'z'; int x,ret; for(; it<'f';it++) { // for(x=0; x<32000;x++) ... (4 Replies)
Discussion started by: a25khan
4 Replies

9. Shell Programming and Scripting

Job Scheduling

Hello, I want to know about job scheduling utilities available in unix. It should not be responsible just for starting the job like in case of cron but should also be able to handle the execution of jobs. Regards, Ritesh (1 Reply)
Discussion started by: turlapaty
1 Replies

10. UNIX for Dummies Questions & Answers

scheduling

i have tried to schedule my process at a certain time using the at command : the error says bad time specification can somebody help me i used at 2300 job thanks (2 Replies)
Discussion started by: prashantuc
2 Replies
Login or Register to Ask a Question