Help with script to capture the performance
Folks;
i have a tool to check on some files, this tool runs using command line. when we run the tool on any file, it suppose to give you the file information to see if the file was digested into the system. for example: if i have a file called "test.gz", when i run the tool which called "chktool" i do it like this: # /opt/dev/chktool -getstat /home/test.gz i normally get results looks like this: Type F Path /home/test.gz Handle F431B8828E6D04 Mode 0766 UID 60000 GID 65534 Size 11706980 NAME test.gz STAT CHEK UID B0514B7A-D20E then when the file is digested, and i run the same tool i got this result below (note the STAT changed from CHEK to ONLN) Type F Path /home/test.gz Handle F431B8828E6D04 Mode 0766 UID 60000 GID 65534 Size 11706980 NAME test.gz STAT ONLN UID B0514B7A-D20E I'm looking to write a script to capture the time when starting to ingest the file then keep running the tool until the status changes from CHEK to ONLN, once it's ONLN then check the time so i can see how long it took for this file to go from CHEK to ONLN. Thanks in advance |
Do you have the source for the "ingestion" process? Wouldn't it be easier
to modify that to provide the metrics? ;} Cheers, Tink |
I wish i did, that's why i'm trying to write a script to do that using the tool but i need help with it
|
Code:
#!/bin/bash the command line. Cheers, Tink |
But i have to run the tool in order to get the results that can have "STAT ONLN", in other word, if my file called katkota.txt then in order to get the results, i have to run this command:
/opt/dev/chktool -getstat /home/katkota.txt then i would see the output with the "STAT ONLN" so only passing the file name to your code will be looking at the file without running the tool |
Easy enough fix...
Code:
#!/bin/bash |
I did that but the script hangs without doing any thing. It seems like it's not running loop until the STAT becomes ONLN. As i explained the STAT at the beginning showing as CHEK then after few seconds it turns into ONLN and i think we should be running the tool using a loop until the STAT changes then calculate the time it took
|
Ooops ... my bad, take the -v out
|
Thanks a lot Tinkster for your help
|
Just a dummy question: what does "!" mean in "while ! grep "STAT ONLN" $1 2>&1>/dev/null"?
|
While NOT
|
Help to script find and grep then remove
Folks;
I'm trying to write a script to scan through a directory tree then for each file it finds, it run a command line tool, then if the results include the word "DONE", it removes the file. In more details; i have a Linux directory tree such as "/opt/grid/1022/store" I'm trying to write a script going through this tree and every file it finds, it should run this command on it: /opt/dev/chktool -getstat file_name |grep -v "DONE" If the output include the word "DONE" then we need to remove it, if not, skip to the next one. Any help is greatly appreciated |
Looked so similar, I merged the two threads ;}
|
I know it looks similar but it's actually not. I think i didn't explain my self correctly:
I think i didn't explain it better, What i'm looking for is to go through the directory tree, find any file under any subdirectory then run the tool on it, if the output include the word "DONE" then remove the file, if not, leave the file alone and go to the next file and do the same thing. I hope that makes it more clear |
Something like this might work ...
Create a file kill_done in your PATH. Code:
#!/bin/bash Code:
find /path/to/subdirs -type f -exec kill_done {} \; Again - untested. Cheers, Tink |
All times are GMT -5. The time now is 10:06 PM. |