[OpenAFS] Is there a simple programatic method of verifying
accessibility of a cell?
Derrick J Brashear
shadow@dementia.org
Wed, 10 Sep 2003 12:18:49 -0400 (EDT)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---559023410-1691952160-1063210729=:7604
Content-Type: TEXT/PLAIN; charset=US-ASCII
> > monitor the state of AFS and the network adapters on a Windows system.
> > When a network adapter is enabled the tool will check the state of AFS.
> > If AFS can reach the specified cell and there are no tokens for the
> > cell, the user will be prompted to obtain them.
>
> Would talking to a fileserver in the cell work, or do you need more than
> that?
I think this needs some work, but I use it for delaying client start on a
fileserver. Jeff Hutzelman wrote it for the CMU Computer Club long ago
(IIRC)
---559023410-1691952160-1063210729=:7604
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="fsping.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.4.55L-032.0309101218490.7604@johnstown.andrew.cmu.edu>
Content-Description:
Content-Disposition: attachment; filename="fsping.c"
LyogZnNwaW5nIC0gUGluZyBhbiBBRlMgZmlsZXNlcnZlcg0KICoNCiAqIHVz
YWdlOiBmc3BpbmcgWy1kIGRlbGF5XSBbLXIgcmV0cnldIFstcXZ3XSBzZXJ2
ZXIgW3BvcnRdDQogKiAgIC1kICAgU2V0IGRlbGF5IGJldHdlZW4gcmV0cmll
cyAoZGVmYXVsdCAxMCBzZWMpDQogKiAgIC1xICAgU2V0IHF1aWV0IG1vZGUg
KG5vIHJlc3VsdHMpDQogKiAgIC1yICAgU2V0IG1heCBudW1iZXIgb2YgdHJp
ZXMgKGRlZmF1bHQgMSkNCiAqICAgLXYgICBUdXJuIG9uIGZzcHJvYmUgZGVi
dWdnaW5nIG91dHB1dA0KICogICAtdyAgIFdhaXQgZm9yIHNlcnZlciBzdGFy
dHVwIG9ubHkNCiAqLw0KDQovKg0KY2MgLW8gZnNwaW5nIGZzcGluZy5jIC1M
L3Vzci9sb2NhbC9saWIvYWZzI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