Trying to make a resync script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trying to make a resync script
# 1  
Old 09-28-2017
Trying to make a resync script

Good Morning,

I'm trying to automate the resync process after a mirror replacement on Solaris. To avoid resyncing all the drives at once, I'm trying to use metastat for each drive to determine if the drive is still resyncing or if it is done (Okay). The following test lines seem to always show false, while removing the "!" always shows true. In other words, it doesn't translate "Resyncing" or Okay" into true/false results:

Code:
While !(metastat d1 | grep "Resyncing" | wc -l | cut -f1 -d' '; do echo ResyncFound; sleep 5; done

Code:
While !(metastat d1 | grep "Okay" | wc -l | cut -f1 -d' '; do echo Okay; sleep 5; done

Any ideas on how to translate "Resyncing" into true?


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 09-28-2017 at 12:00 PM.. Reason: Added CODE tags.
# 2  
Old 09-28-2017
Welcome to the forum.

Did you consider evaluating grep's exit code?
And, I'm not sure what that construct be: !( , even more when the closing parenthesis seems to be missing? Shouldn't while be lower case?
This User Gave Thanks to RudiC For This Post:
# 3  
Old 10-05-2017
Thanks- I'm using Solaris 9 which doesn't seem to recognize exit code option
Code:
-q

. Sorry- forgot to mention that. What I have up there is an attempt to simulate that.

The
Code:
!

will invert the true/false. I think that part is working actually. The cap and the missing closing parenthesis are typos here. Sorry again.

Long story short- I just want to be able to read metastat somehow, and if a drive is still resyncing, wait until its okay, then move to the next drive, and so on.
# 4  
Old 10-05-2017
Quote:
Originally Posted by Stellaman1977
Thanks- I'm using Solaris 9 which doesn't seem to recognize exit code option
Code:
-q

. [..]
Yes it does. You need to use /usr/xpg4/bin/grep for that..
This User Gave Thanks to Scrutinizer For This Post:
# 5  
Old 10-12-2017
Quote:
Originally Posted by Scrutinizer
Yes it does. You need to use /usr/xpg4/bin/grep for that..
Thanks.. That works!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Reboot causes disks in Resync State

Dear Team, This time i am facing some new problems which is beyond my thinking. I need some expert advice. We are having 4 Servers ( 2 nos Sun SPARC Enterprise T5220 & 2 nos of SF e2900 Servers ). Both the T5220 Servers are Termed as Node A and Node B . The same things are followed with... (1 Reply)
Discussion started by: sudhansu
1 Replies

2. UNIX for Dummies Questions & Answers

Can I reboot during a metadevice resync?

In my infinite lack of wisdom, I brought a Solaris 10(Sparc, 64 bit ) system down to init 1, detached a metadrive so that I could run format->analyze->refresh on it, and then reinit'd and reattached it . It started syncing the drive as it's a submirror of a mirrored drive, which happens... (8 Replies)
Discussion started by: the.gooch
8 Replies

3. AIX

Resync data on File system

Hi All, I have two mount points have the same data with little changes between them /appabc1 /appabc2 Both of them have the same data, there is some little changes on the data between them I want /appabc2 to has the same data of /appabc1 exactly including to those little changes... (6 Replies)
Discussion started by: Mr.AIX
6 Replies

4. Shell Programming and Scripting

how to run script? call other script? su to another user? make a cron?

Good morning. I am searching for "how-to"'s for some particular questions: 1. How to write a script in HP-UX 11. 2. How to schedule a script. 3. How to "call" scripts from the original script. 4. How to su to another user from within a script. This is the basics of what the... (15 Replies)
Discussion started by: instant000
15 Replies

5. Shell Programming and Scripting

trailing slash - resync command

Hi All, i am aware that there is a difference between: 1. rsync -n -av /tmp . 2. rsync -n -av /tmp/ . I would like to do the first option. But if i use a variable (rsync -av $log .), the command behaves like a second option (with the trailing slash) Is there any way to use a... (2 Replies)
Discussion started by: c00kie88
2 Replies

6. AIX

How long does AIX resync the time with another server

Hi, I have NTP configured: vi /etc/ntp.conf broadcastclient server 128.127.1.3 driftfile /etc/ntp.drift tracefile /etc/ntp.trace # xntpdc xntpdc> sysinfo system peer: 128.127.1.3 system peer mode: client leap indicator: 00 stratum: 12 precision: ... (0 Replies)
Discussion started by: victorcheung
0 Replies

7. Linux

HELP PLEASE about Resync and sync interval in linux

Can anyone could tell me what is the meaning of this problem: Last successful check resync is greater than min sync interval (1195785433 > 7200) And what can do to solve this problem. Thank you..Please HElp me! (4 Replies)
Discussion started by: o_m_g
4 Replies

8. UNIX for Dummies Questions & Answers

raidctl and resync when reboot

I am using raidctl on a v440 disk and noticed it resyncs after every boot, which takes about 30 minutes because of the size of the partition. I am concerned with what happens during the resync if "writes" happen to the disk before it is complete? Any info would be helpful. Thanks (0 Replies)
Discussion started by: csgonan
0 Replies

9. Shell Programming and Scripting

Help make script much easier

Is there any method to realise this in one command? Thanks in advance (2 Replies)
Discussion started by: GCTEII
2 Replies

10. Programming

make script

I need to write a make script to install a C module in a UNIX environment.It should install the sources, build the libraries and install them and also install the info pages on the system. Can this script be general enough to also install on windows, windows dll, windows help file's etc. Any... (3 Replies)
Discussion started by: cherio
3 Replies
Login or Register to Ask a Question