|
Search Forums |
Tag Search |
Advanced Search |
Quick Links |
Contact Us |
Forum Rules |
Today's Posts |
FAQ |
Pictures & Albums |
All Albums |
Miscellaneous |
What is My IP |
Whois |
Mark Forums Read |
#!/sbin/sh SID=smrtprod . qa02 set -x Day_Of_Week=`date +%a` Hour=`date +%H` if [ $Day_Of_Week = "Sat" ] then if [ $Hour -ge 17:00 -a $Hour -le 02:45 ] then echo "In Maintenance Window, exiting out" exit else echo "select 'DB up' from dual;" | sqlplus -s oramonitoring/temp123@smrtprod if [ $? -eq 0 ]; then : else echo " Database $SID has issue." | mailx -s "Database $SID is down, please act on this" CSC-ORACLE-DBA@Estee.com, 919642990137@nma.vodafone.in fi fi fi echo "successfull complete" exit 0
if [ $Hour -ge 17:00 -a $Hour -le 02:45 ]
if [ ( $Day -eq "Sat" -a $Hour -gt 17:00 ) -o ( $Day -eq "Sun" -a $Hour -le 02:45 ) ]
#!/sbin/sh SID=smrtprod . qa02 if [ $Day -eq "Sat" -a $Hour -gt 17:00 -o $Day -eq "Sun" -a $Hour -le 02:45 ] then echo "In Maintenance Window, exiting out" exit else echo "select 'DB up' from dual;" | sqlplus -s oramonitoring/temp123@smrtprod if [ $? -eq 0 ]; then : else echo " Database $SID has issue." | mailx -s "Database $SID is down, please act on this" CSC-ORACLE-DBA@Estee.com, 919642990137@nma.vodafone.in fi fi echo "successfull complete" exit 0 none> ./time.sh ./time.sh[4]: Sat: A test command parameter is not valid.
#!/usr/bin/ksh typeset -i mHHMM=`date +%H%M` mDay=`date +%a` if [[ "${mDay}" = "Sat" && ${mHHMM} -gt 1700 ]]; then echo "Exiting because it is Saturday after 17:00" exit fi if [[ "${mDay}" = "Sun" && ${mHHMM} -lt 245 ]]; then echo "Exiting because it is Sunday before 2:45" exit fi <write your code here>
#!/sbin/sh SID=smrtprod . qa02 set -x Day=`date +%a` Hour=`date +%H` if [ "$Day" = "Sat" ] then if [ "$Day" -eq "Sat" -a $Hour -gt 17:00 -o "$Day" -eq "Sun" -a $Hour -le 02:45 ] ; then echo "In Maintenance Window, exiting out" exit else echo "select 'DB up' from dual;" | sqlplus -s oramonitoring/temp123@smrtprod if [ $? -eq 0 ] ; then : else echo " Database $SID has issue." | mailx -s "Database $SID is down, please act on this" fi fi echo "successfull complete" exit 0