Need help to check the copy % from following output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help to check the copy % from following output
# 1  
Old 03-22-2012
Need help to check the copy % from following output

I have a scenario where I need to wait for the copy to be 100% in the following output

There can be multiple devices in the copy session so I need to wait till everything becomes 100%, also we can look for the protected tracks t0 become 0
Code:
opey # symclone -sid 822 -v -f /symclone_mappings.txt query
 
SELECTING the list of Source devices in the group:
 
Device: 008C [SELECTED]
 
SELECTING Target devices in the group:
 
Device: 00F5 [SELECTED]
 
PAIRING of Source and Target devices:
 
Devices: 008C(S) - 00F5(T) [PAIRED]
 
Device File Name : /symclone_mappings.txt
Device's Symmetrix ID : 000290300822
 
Source Device Target Device State Copy
--------------------------------- ---------------------------- ------------ ----
Protected Modified Modified
Logical Sym Tracks Tracks Logical Sym Tracks CGDP SRC <=> TGT (%)
--------------------------------- ---------------------------- ------------ ----
N/A 008C 28208 0 N/A 00F5 0 X... PreCopy 12
 
Total -------- -------- --------
Track(s) 28208 0 0
MB(s) 1763.0 0.0 0.0
 Legend:
 
(C): X = The background copy setting is active for this pair.
. = The background copy setting is not active for this pair.
(G): X = The Target device is associated with this group.
. = The Target device is not associated with this group.
(D): X = The Clone session is a differential copy session.
. = The Clone session is not a differential copy session.
(P): X = The pre-copy operation has completed one cycle
. = The pre-copy operation has not completed one cycle

Moderator's Comments:
Mod Comment Please enclose output in code tags

Last edited by jim mcnamara; 03-22-2012 at 10:54 AM..
# 2  
Old 03-22-2012
Code:
if grep -q 100% /path/to/log
then
   echo foo
fi

# 3  
Old 03-23-2012
I've simplified your request to:

All lines between a line ending in "'(%)" and a line starting in "Total" must have the last field = 100

Code:
symclone -sid 822 -v -f /symclone_mappings.txt query | awk '
   a&&$1=="Total"{exit 0}
   a&&NF>2&&$NF!="100"&&!/^-/{exit 2}
   $NF=="(%)"{a=1}'
if [ $? -eq 0 ]
then
     echo "All done"
else
     echo "Still copying"
fi

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to check and copy column entries

Hi I have a text file (INPUT.TXT) of three columns assuming they are separated by tab. The format is given as: Column1 Column2 Column3 aaa NO aaa bbb YES asdf ccc YES yyasdf ddd NO ddd eee ... (3 Replies)
Discussion started by: my_Perl
3 Replies

2. Shell Programming and Scripting

Shell script which will check the target file and folder exists and copy it

Hi All, I am a beginner in this and trying to write a shell script in linux which will : 1. Ask for a file name and check if its exists. 2. If file exists only then it will ask for the new target folder, after entering target folder name it will check if it exists. 3. If target folder... (3 Replies)
Discussion started by: ashish_neekhra
3 Replies

3. Shell Programming and Scripting

Automation, Copy, File Status Check --> Script(s)

All, I have to write a script to do the following requirement. There is a file called BUSINESS_DATE.TXT. This file get updated once the oracle partition created. In Oracle, Partition will be created every day. There is a seperate script scheduled to take care ORACLE partition creation. The... (3 Replies)
Discussion started by: karthi_mrkg
3 Replies

4. Shell Programming and Scripting

shell script to check permission before copy over

Hi, I am writing some shell script to check the file owner permission whether the write bit is turn on. If it is turn on it will copy the file to the destination else it will just prompt user to change the file and skipping it. However, I am starting getting loss here as I have couple of... (2 Replies)
Discussion started by: wanaka
2 Replies

5. Shell Programming and Scripting

check if file finished to copy

Hi all, I have a script that is monitoring a hot folder. This script works fine with one exception when the script is executed while a file is being copied to the hot folder. What is the easiest method to check if the copy file is completed? I'd like to get the solution in bash :) (8 Replies)
Discussion started by: gigagigosu
8 Replies

6. Shell Programming and Scripting

check if some file is in copy process, then transfer it

my user copy large files, and it's take 10min for file to be copied to the server (/tmp/user/ files/), if in the meantime start my scheduled script, then it will copy a part of some file to server1 my idea is to check the file size twice in a short period (1-2 seconds) of time, then compare, if... (5 Replies)
Discussion started by: waso
5 Replies

7. Shell Programming and Scripting

Need a script to copy files and check

Hi all, I need a script in ksh: 1: Copy files from directory (A) to directory (B) 2: Check if files that will be copied in directory (A) have never been yet copied to (B) 3: Never copy the last created file of directory (A) This script will run on crontab. Thanks in advance for your... (1 Reply)
Discussion started by: Camaro
1 Replies

8. Shell Programming and Scripting

Copy Files to Dir and Check If File Exists

Hi everyone. I am trying to write a bash script that will copy files from one directory to another but I need to be able to check the directory that I'm copying the files to and see if the file already exists. If it does I need to add a number at the end of the copied file. Thanks for your help. (3 Replies)
Discussion started by: snag49ers
3 Replies

9. Shell Programming and Scripting

How to check a file exist and do a copy of other files

Hi, I would like to perform bash which would check the file A.txt to be size 0 or not. If the size is 0, I would copy file B.txt to replace A.txt. Please help. Thanks. -Jason (6 Replies)
Discussion started by: ahjiefreak
6 Replies

10. UNIX for Dummies Questions & Answers

I want to copy the text output from a 'nohup.out' file.

Hello, I have a nohup.out file that, when executed, outputs a spreadsheet file with four-to-seven columns of number. I want to copy this output (in its entirety), so that I could then paste it on excel@ , or Notepad@. Please help, thanks. (3 Replies)
Discussion started by: Iamthe great
3 Replies
Login or Register to Ask a Question