Code not worked,as expected

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Code not worked,as expected
# 1  
Old 08-14-2011
Code not worked,as expected

Hi All,

OS :- HPUX..

I have a following code, which I wrote to meet date and time condition. The below code refuse to work for some reason, I still don't have any idea, why ?
the below code, should exit out, if the day happens to be sat and time greater the 04:00 pm. I am bit surprised, that it continues to travel all of the block and send out us a mail, which it should not.
. qa02
typeset -i mHHMM=`date +%H%M`
typeset -i mDD=$(date +%d)
mDay=`date +%a`
if [[ "${mDay}" = "Thu" && ${mHHMM} -gt 1300 ]]; then
echo "Exiting because it is Thursday  after 13:00"
if [[ "${mDay}" = "Sun" && ${mHHMM} -lt 0245 ]]; then
echo "Exiting because it is Sunday before 2:45"
if [[ ${mDD} -ge 20 && ${mDD} -le 22 ]]; then
echo "Second Monday of the month"
sleep 500
tnsping $SID
if [ $? -eq 0 ] ; then
echo " Listener of $SID has issue." | mailx -s "Listener down of $SID , please act on this",
echo "select 'DB up' from dual;" | sqlplus -s oramonitoring/temp123@$SID
if [ $? -eq 0 ] ; then
echo " Database $SID has issue." | mailx -s "Database $SID is down, please act on this"
echo "successfull complete"exit

# 2  
Old 08-16-2011
Still no reply, is there anything, which I needed to be more specific ?
# 3  
Old 08-16-2011
You agreed not to bump posts when you registered here. We are not "on call".

Numbers that begin with 0 are considered to be octal by typeset, which may cause it to barf when it contains digits >7. You might want to use ASCII comparison instead, \< \>, if your shell supports it.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Calculating Total Hours worked

Write a script using a Linux shell programming language to perform clock management for a small daycare. The program should manage all time in and out routines. At the end of the each day should give the Total hours worked that day. Example: Time-In 6:30am Lunch-Out 11 :25am... (1 Reply)
Discussion started by: sarapham409
1 Replies

2. UNIX for Beginners Questions & Answers

Sleep command did not worked

Hi All, We have a process which is running for last 2 years well and good in production. But suddenly yesterday there was issue we faced in the process. The actual process is what it does like below. 1. Receive the files in NAS directory(N/w attached storage). 2. Trigger the... (11 Replies)
Discussion started by: mad man
11 Replies

3. Shell Programming and Scripting

Shell script worked correctly until I added variable :(

Hi everyone, I have been using a shell script for the last 6 months to copy a database from a POS system, then analyse the database and print the current sales total. This has worked flawlessly, the only issue was that I had hard coded the IP address of the POS and occasionally I would need to... (23 Replies)
Discussion started by: gjws
23 Replies

4. Shell Programming and Scripting

My code worked on a Mac, now it does not work in another computer

I guess Mac has default bash. Then I copy my code to another comp and run it...And it gives me an error like "bad substitution".... How I can change my code??? Never had before this kind of situation. Help please. if then n=$(sort /Users/Natalie/lastserial | tail -1) ... (6 Replies)
Discussion started by: Natalie
6 Replies

5. Programming

C++: No output for Char* when on AIX. Worked on Linux

Hi All, I have a script (attached) that was working fine on Linux. I compiled it there using g++ CrncyFmt.cpp -o CrncyFmt.o When I ran it there using eg. CrncyFmt.o 2343.565 2 I get as expected: CharOut = " 2,343.57" Now we have moved to our test box which is AIX and I... (11 Replies)
Discussion started by: Leedor
11 Replies

6. Solaris

Anyone worked with ldmp2v?

Hi, has anyone worked with ldmp2v utility to convert a physical machine to a virtual. I am been trying to convert an ultra 45 (test machine) to an ldom on a T6320 blade server (with ldom manager 1.3) but have been unsuccessful. The firmware of the blade has been upgrade to the latest available.... (0 Replies)
Discussion started by: Mack1982
0 Replies

7. Shell Programming and Scripting

PHP: Search Multi-Dimensional(nested) array and export values of currenly worked on array.

Hi All, I'm writing a nagios check that will see if our ldap servers are in sync... I got the status data into a nested array, I would like to search key of each array and if "OK" is NOT present, echo other key=>values in the current array to a variable take the single array... (1 Reply)
Discussion started by: zeekblack
1 Replies

8. Shell Programming and Scripting

test to see if useradd worked

I am trying to write a script that does a useradd -G <group> <user> but you cannot modify the user if he/she is logged on. How could I check to see if the user is on or if the user has been added to the group successfully? I plan on having the script sleep for a couple mins if the user is on then... (3 Replies)
Discussion started by: doublejz
3 Replies

9. UNIX for Dummies Questions & Answers

Variables being worked on inside of loops

I have a while read loop that reads values inside of a file and then performs an expr operation on each. Everything works fine, the way it's supposed to but, once the loop is finished, I can not access the variable that I used inside of the loop (but that variable was created outside of the... (7 Replies)
Discussion started by: yongho
7 Replies
Login or Register to Ask a Question