While loop in certain interval


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting While loop in certain interval
# 15  
Old 10-15-2013
I think RudiC's long line may have been truncated.

I also think the following may do what you want on a SunOS system, but since you didn't supply any sample of your list.txt file contents, I can't make any guarantees.
Code:
#!/bin/ksh
while hour=$(date +%H)
do      if [ $hour -ge 6 ] && [ $hour -lt 19 ]
        then    exit 20
        fi
        all_found=1
        while IFS="," read group file X
        do      if [ -f "$file" ]
                then    time=$(ls -l "$file" | nawk '{print $6,$7,$8}')
                        printf "%s,%s,%s,YES\n" "$group" "$file" "$time"
                else    all_found=0
                        printf "%s,%s,NO\n" "$group" "$file" 
                fi
        done < list.txt
        if [ $all_found -eq 1 ]
        then    exit 0
        else    sleep 900
        fi
done

These 2 Users Gave Thanks to Don Cragun For This Post:
# 16  
Old 10-16-2013
Thanks. Yes, it was truncated, I corrected the post.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Repetition in a particular interval

Suppose I have a word which is repeating in a string continuously. I have a set of intervals. Then how do I find the number occurrences of that word in those intervals and their location of occurrences. For example - Suppose there is a huge string anfie.......sirn of 10000 letters. Now the word... (2 Replies)
Discussion started by: ANKIT ROY
2 Replies

2. Shell Programming and Scripting

Interval merging

I do have a file (file1) with a specified interval of 500 counts file1 0 500 500 1000 1000 1500 1500 2000 2000 2500 2500 3000 3000 3500 3500 4000 4000 4500 4500 5000 5000 5500 5500 6000 6000 6500 6500 7000 7000 7500 7500 8000 (3 Replies)
Discussion started by: Kanja
3 Replies

3. Shell Programming and Scripting

interval based count

Hi, I have a file with 4 million rows. what i am trying to achieve is for every 1000 interval count the number of rows and display it i/p 12 200 400 750 1000 1500 1800 2200 2345 2600 2896 3020 3400 (0 Replies)
Discussion started by: Diya123
0 Replies

4. Solaris

NTP polling interval

Is it possible to change the ntp poll manually. I notice that ntp poll is changing autimatically. (1 Reply)
Discussion started by: ningy
1 Replies

5. Shell Programming and Scripting

grep searching interval

Hi all, I just want to find all values that are in a specified interval. I tryed it with grep e- file , it does not work. Is it possible to get values wich are lower a special number, like grep >e-18 file? Thanks a lot (4 Replies)
Discussion started by: newcommer
4 Replies

6. Shell Programming and Scripting

compare the interval of 2 numbers of input2with interval of several numbers of input1

Help plz Does any one have any idea how to compare interval ranges of 2 files. finding 1-4 (1,2,3,4) of input2 in input1 of same key "a" values (5-10, 30-40, 45-60, 80-90, 100-120 ). Obviously 1-4 is not one of the range with in input1 a. so it should give out of range. finding 30-33(31,32,33)... (1 Reply)
Discussion started by: repinementer
1 Replies

7. UNIX for Advanced & Expert Users

Summation of the column value in an interval.

Hey, I have a file with following data.. and I want to get the summation of 10th column. And this happens in every 10 seconds for a minute max. 242001 A mqsitst 794864 1249516 0 60 20 293050400 77016 * 02:05:33 - 0:04 DataFlowEngine EAITIBR2_BROKER... (6 Replies)
Discussion started by: varungupta
6 Replies

8. OS X (Apple)

interval in a launchd script

Hi, i'm planning a to automate my backup with a rsync user deamon in my launchd and let that run every 2 hours. my server contains a lot of video data which can expand rapidly , up to 1TB, in an interval of 2 hours. now i'm wondering what will happen when a rsync is running longer then the... (1 Reply)
Discussion started by: wessel
1 Replies

9. Shell Programming and Scripting

Need Help for interval date

Hello, I need help about a shell script I have a text file with this fields: 2009/01/19 09:33:35: --> ---ORA-28817: PL/SQL function returned an error. 2009/01/19 09:33:35: --> ---ORA-28817: PL/SQL function returned an error. 2009/01/19 09:33:35: --> ---ORA-28817: PL/SQL function returned an... (4 Replies)
Discussion started by: giofai
4 Replies

10. Solaris

Time Wait interval

What is the time_wait interval for Solaris 8/9??? and is it configurable??? For example sometimes a clients pc will freeze up dropping the connection, closing the port. The problem is on our side our system still thinks their logged in (until it realizes it dropped on the otherside and drops on... (1 Reply)
Discussion started by: eloquent99
1 Replies
Login or Register to Ask a Question