bash - unix script should run 9-21 hrs on weekdays (mon-sat) and on sunday (9-14 and 17-21hrs). It executes a procecudure in oracle -


    start_date=`date '+%d%m%y%h%m%s'` dayofweek=$(date +"%u") start_hour=$(date +"%h")   run_dt=`date '+%d%m%y'` run_hr=`date '+%h%m'` echo 'run_hr' $run_hr  echo 'shell script started' echo ${start_date} echo ${dayofweek} echo ${start_hour}  while [ $run_hr -lt 21]; if [ $dayofweek = 1 ] || [ $dayofweek = 2 ] || [ $dayofweek = 3 ] || [ $dayofweek = 4 ] || [ $dayofweek = 5 ] || [ $dayofweek = 6 ]; echo 'inside while'  sqlplus -s xx/abcd<< end2 set timing on;  select to_char(sysdate,'dd-mm-yyyyhh24:mi') starttime dual; #exec my_proc(); select to_char(sysdate,'dd-mm-yyyyhh24:mi') endtime dual; end2  sleep 120 let run_hr=`date '+%h%m'` echo 'run_hr' $run_hr  elif [ $dayofweek = 7 ]; echo 'inside while on sunday' sqlplus -s xx/abcd<< end2 set timing on;  select to_char(sysdate,'dd-mm-yyyyhh24:mi') starttime dual; #exec my_proc(); select to_char(sysdate,'dd-mm-yyyyhh24:mi') endtime dual; end2  sleep 120 if [ $run_hr -eq 14 ]; sleep 10800else let run_hr=`date '+%h%m'` echo 'run_hr' $run_hr echo 'nothing' fi else echo 'off' fi done  echo 'exiting' 

by keeping in while loop proc runs every time initiating @ 9am in morning cron. on sunday, have keep 3 hrs in sleep @ 14:00 hrs. can please tell me how keep sleep 3 hrs on sunday. in advance!

you try create script (like monitor script)that execute 1 posted: monitor_script: put in crontab , executed every minute procedure_script: script

the purpose of monitor_script to:

  1. check if procedure_script "up & running"
  2. execute procedure_script if reason goes down
  3. insert in monitor_script "if" like: if [ $dayofweek -eq 6 ] && [ $yourtimevar == "14" ];then sleep 3hrs fi

regards c


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -