[SOLVED] to check the job status basis on multiple pattern
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am writing one script to check the status of my job by checking the log file, is that completed or not ,I have one scheduler log file which i am downloading from windows server to AIX and searching the current date, job name and status code, getting issues to fix it by awk -v RS="" -v FS="\n" -v D="$(date +/%m/%d/%Y)".
in the log file date is in windows format 8/29/2014 .
please refer the below log file, so wanted to check for the current date abcd.job has finished successfully on the basis of completion code.if success it should give success message else failure.
"abcd.job" (abcd.bat)
Started 8/24/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/24/2014 5:07:04 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/24/2014 7:00:00 AM
"Eventlog.job" (Event_clear.vbs)
Started 8/24/2014 7:00:01 AM
"Eventlog.job" (Event_clear.vbs)
Finished 8/24/2014 7:00:06 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/24/2014 7:00:09 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/25/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/25/2014 5:06:58 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/25/2014 7:00:00 AM
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/25/2014 7:00:08 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/26/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/26/2014 5:07:01 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/26/2014 7:00:00 AM
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/26/2014 7:00:08 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/27/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/27/2014 5:07:00 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/27/2014 7:00:00 AM
"Eventlog.job" (Event_clear.vbs)
Started 8/27/2014 7:00:02 AM
"Eventlog.job" (Event_clear.vbs)
Finished 8/27/2014 7:00:05 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/27/2014 7:00:10 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/28/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/28/2014 5:07:05 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/29/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/29/2014 5:07:05 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/28/2014 7:00:00 AM
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/28/2014 7:00:09 AM
Result: The task completed with an exit code of (0).
[ ***** Most recent entry is above this line ***** ]
"abcd.job" (abcd.bat)
Started 8/24/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/24/2014 5:07:04 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/24/2014 7:00:00 AM
"Eventlog.job" (Event_clear.vbs)
Started 8/24/2014 7:00:01 AM
"Eventlog.job" (Event_clear.vbs)
Finished 8/24/2014 7:00:06 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/24/2014 7:00:09 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/25/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/25/2014 5:06:58 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/25/2014 7:00:00 AM
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/25/2014 7:00:08 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/26/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/26/2014 5:07:01 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/26/2014 7:00:00 AM
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/26/2014 7:00:08 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/27/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/27/2014 5:07:00 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/27/2014 7:00:00 AM
"Eventlog.job" (Event_clear.vbs)
Started 8/27/2014 7:00:02 AM
"Eventlog.job" (Event_clear.vbs)
Finished 8/27/2014 7:00:05 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/27/2014 7:00:10 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/28/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/28/2014 5:07:05 AM
Result: The task completed with an exit code of (0).
"abcd.job" (abcd.bat)
Started 8/29/2014 5:00:00 AM
"abcd.job" (abcd.bat)
Finished 8/29/2014 5:07:05 AM
Result: The task completed with an exit code of (0).
"CRF Analysis.job" (CRF Analysis.bat)
Started 8/28/2014 7:00:00 AM
"CRF Analysis.job" (CRF Analysis.bat)
Finished 8/28/2014 7:00:09 AM
Result: The task completed with an exit code of (0).
[ ***** Most recent entry is above this line ***** ]
We WILL be happy to help you, but you have to post what YOU have written/tried on your own first, and tell us where you're stuck. If you want someone to write your scripts for you, then post this in the LQ Job Marketplace, along with how much you want to PAY SOMEONE to do your work, and someone will be happy to.
You have been working with Linux for three years now...there are MANY scripting tutorials available, and you've been given samples before. Apply what you've learned and show some effort.
awk -v RS="" -v FS="\n" -v D="$(date +/%m/%d/%Y)" but getting NIL output for every case...
so wanted to check for the current date abcd.job has finished successfully on the basis of completion code.if success it should give success message else failure
So first finding the current date in file , then job name for the current date and its status (exit code),problem is in either of the case its giving NIL out put..
Output is NIL... So first finding the current date in file , then job name for the current date and its status (exit code),problem is in either of the case its giving NIL out put..
Right, because again, as unSpawn said, you are declaring things, but not actually USING THEM.
If you want to 'debug' the line you posted, type in one command at a time, and see what the output is after each step. Personally, given the input data, I'd use grep to grab the jobs..pay particular attention to the -A and -B flags on the grep man page. That will get you the 'group' around the abcd.job lines, and you can shove that whole thing into an array, and process it accordingly.
Thanks , As you Quated below , that is what i was looking for assistance not for complete solution..
grouping the lines into array... That will get you the 'group' around the abcd.job lines, and you can shove that whole thing into an array, and process it accordingly.
Thanks , As you Quated below , that is what i was looking for assistance not for complete solution..
grouping the lines into array... That will get you the 'group' around the abcd.job lines, and you can shove that whole thing into an array, and process it accordingly.
When you post no code of your own, and ask people to 'help you write your script' over and over, without ever actually SHOWING US any of your own work, it certainly seems like you were (again), asking someone to write your scripts.
There are many scripting tutorials you could have easily found to show you how to do what you're after.
This is what i have written and achieved the expected result and i was expecting a a one line snippet to sort out the the things not the entire script which is more than 100 lines and which is already written by me.
Anyway marking this thread as resolved, thanks all for your valuable time.
This is what i have written and achieved the expected result and i was expecting a a one line snippet to sort out the the things not the entire script which is more than 100 lines and which is already written by me.
Then why didn't you post it, since you were asked for it many times?
Quote:
Anyway marking this thread as resolved, thanks all for your valuable time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.