How to check xml file through out the day


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to check xml file through out the day
# 1  
Old 12-05-2011
How to check xml file through out the day

Hi,

I have a file with extension xml. So i need to search for this file and sftp.

This script has to run from 8.00am to 8.00pm and during this when ever a file with *.xml exists in a particular directory , it has to sftp that file.

How can i make script check for this file through out the day ?

Kindly help.
# 2  
Old 12-05-2011
Code:
if [ $(date +%H) -ge 8 -o $(date +%H) -le 20 ]
then
        ls -ltr *.xml > /dev/null
        if [ $? -eq 0 ] ; then
                <<sftp-code>>
        else
                echo "Files not present"
        fi
fi

# 3  
Old 12-05-2011
How to check xml file through out the day

Also make a entry into crontab to run the below script on regular interval like this :

* 8-20 * * * <script file with path> Smilie
hope this will solve ur query.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check day name is it saturday in bash shell script?

How to check the day name,is it saturday in bash shell script. If dayname = saturday then run the full load else run just the incremental loads end if Thank you very much for the helpful information. (4 Replies)
Discussion started by: cplusplus1
4 Replies

2. Shell Programming and Scripting

Check null value in xml

Hi, I have a log file which is having some xml tags. I need to check the value for a particular xml field is null or not and if it is null i have to add current time as the value for that xml field. I tried below code to check whether the word count is 0. But even if the xml field is null it... (16 Replies)
Discussion started by: Neethu
16 Replies

3. Shell Programming and Scripting

Help required in Splitting a xml file into multiple and appending it in another .xml file

HI All, I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz. eg: <?xml version="1.0"?>... (4 Replies)
Discussion started by: ganesan kulasek
4 Replies

4. Shell Programming and Scripting

Writing a script to run weekly/monthly - check for weekday or day-of-the-month

Hi all, I currently have a UNIX file maintenance script that runs daily as a cron job. Now I want to change the script and create functions/sub inside it that runs on a weekly or monthly basis. To run all the scripts' daily maintenance, I want to schedule it in cron as simply maint.sh... (1 Reply)
Discussion started by: newbie_01
1 Replies

5. Shell Programming and Scripting

Shell program to check if the same text appears twice in an XML file

Hi All, I am very new to this forum and beginner to shell scripting. I need a shell script to: Search for a text in XML file à if the same text appears twice in an XML file à output file name Script should loop thru every xml file of a given folder. Please help me writing this script. ... (1 Reply)
Discussion started by: amardeep001
1 Replies

6. Shell Programming and Scripting

Script to check if last modified day is previous day

Hi, I would like to write a script that checks if a file ('counter') was modified the previous day, if so erase its contents and write 00000000 into it. For e.g. if the file 'counter' was last modified at 11.30pm on 24th May and the script runs at 12.15am of 25th May, it should erase it's... (1 Reply)
Discussion started by: hegdepras
1 Replies

7. Shell Programming and Scripting

Script to check for the newest file mutiple times a day and SCP it to another server.

Hi, I need a sample of a script that will check a specific directory multiple times throughout the day, and scp the newest file to another server. Example: current file is misc_file.txt_02272011 (the last part is the date), once that has been secure copied, another one may come in later the... (1 Reply)
Discussion started by: richasmi
1 Replies

8. Shell Programming and Scripting

Check File Exists and compare to previous day file script

We have data files that are ftp'd every morning to a SUN server. The file names are exactly the same except for that each has the date included in its name. I have to write script to do 2 things: STEP 1) Verify that the file arrived in morning. STEP 2) Compare the file size of the current... (3 Replies)
Discussion started by: rbknisely
3 Replies

9. UNIX for Dummies Questions & Answers

How can i check for a day

Hi, When i tried this I am getting bad number if ]; then now=saturday echo $now; else now=notsaturday echo $now; fi How can i check for the same. Thanks in advance (I am new to Unix and so i raise some silly questions, please dont mistake me) cheers, gops (3 Replies)
Discussion started by: gopskrish
3 Replies

10. Shell Programming and Scripting

How to compare prev day file to current day file

Hi all: I am new to this board and UNIX programming so please forgive if I don't explain something correctly. I am trying to write a script to keep track of our links, we link one program written for Client A to Client B's directory. What we want to do is to keep track of our linked programs... (1 Reply)
Discussion started by: Smurtzy
1 Replies
Login or Register to Ask a Question