combining two scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting combining two scripts
# 1  
Old 11-26-2008
combining two scripts

Hi ,

Following are the two scripts :-

Script 1)

#!/bin/sh
cp file.log file.log.1

Script 2)

#!/bin/sh
diff file.log file.log.1 > DIFFERENCE.log
cp file.log file.log.1
grep "ERROR" DIFFERENCE.log
if [ $? -eq 0 ]; then
echo "1"
else
echo "0"
fi

The first script is just to run once and afterwards we have to run the second script.The first script will make just a copy of original log file so that whenever we seek for the recent error , we can run the second script.The second script will compare the original file with the copied one and whenever the new entries will come in original file with word error , it will display it. If no error will come then it will display only 0, means no recent error came. The second script will check for the fresh logs , that is why the we need to copy the whole script at leats once in a life time

Now I want to combine these two scripts into one in such a manner that the first script runs only once in a lifetime and the other keeps on running after a fixed interval of time.

Kindly suggest how to combine these two ?


I have to recall the first script withing the second script .

Regards

Last edited by himvat; 11-26-2008 at 02:40 AM..
# 2  
Old 11-26-2008
Make two scripts and set it as a cronjob

Regards,
Scorpio
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Combining two scripts into a single script

Hi Folks, I have two scripts that are used to start and stop services these scripts are at the location /opt/app/tre , so that start.sh internally starts the components and stop.sh internally stop all the components, now rite now if I have to stop the services then i need to go first the... (9 Replies)
Discussion started by: punpun66
9 Replies

2. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

3. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

4. Shell Programming and Scripting

Combining two shell scripts

Hi readers, I have two shell scripts running on linux machine. Both the scripts do the following task - Connect to DB - Create temp files - run select statement on table - write the rows returned on temp file Sample code is below #!/bin/sh export ORACLE_HOME=/content/oracle/10.2.0... (1 Reply)
Discussion started by: manucorbi
1 Replies

5. Shell Programming and Scripting

Combining two awk scripts

I have a file like this consisting of blocks separated by > of two number X and T > 10 0 13 5.92346 16 10.3106 19 13.9672 22 16.9838 25 19.4407 28 21.4705 31 23.1547 34 24.6813 37 26.0695 40 27.3611 43 28.631 46 29.8366 49 30.9858 52 32.0934 55 33.1458 (6 Replies)
Discussion started by: kristinu
6 Replies

6. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

7. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

8. Shell Programming and Scripting

Help with Script using rsh and scripts within scripts

Hi, I've written a script that runs on a Database server. It has to shutdown the Application server, do an Oracle Dump and then restart the Application server. Its been a long time since I wrote any shells scripts. Can you tell me if the scripts that I execute within my script will be executed... (3 Replies)
Discussion started by: brockwile1
3 Replies

9. UNIX for Dummies Questions & Answers

Profile scripts versus rc scripts....

what is the difference between login and profile scripts versus the rc scripts? (1 Reply)
Discussion started by: rookie22
1 Replies

10. Shell Programming and Scripting

Combining 2 scripts

Hello I am new to shell scripting. Below are 2 scripts which I need to combine in to single script.Can some experts guide me how to proceed? #!/bin/bash grep "2443" /f/log/s/heduler.log | grep 2443> /tmp/memorydump exec 6<"/tmp/memorydump" read -u 6 data if then echo "IN THEN" <... (4 Replies)
Discussion started by: achararun
4 Replies
Login or Register to Ask a Question