Hi
Todd's solution is working, to check from the ~/.cvspass.
To summary, when a user has not logged on to cvs:
$ grep "$CVSROOT" ~/.cvspass |awk '{print $3}'
$
After a user logged on to cvs:
$ grep "$CVSROOT" ~/.cvspass |awk '{print $3}'
A,>d^?=I"1
$
Thank everyone!
On Wed, Feb 4, 2009 at 10:42 PM, Todd Denniston <
[email protected]> wrote:
> Amaresh Chandra Das wrote, On 02/04/2009 12:53 AM:
>
>> Hi Hez,
>>
>> Please use this bellow command ,
>> if someone is logged in then you will get message like " \_ ssh
>> amares...@cvs"
>>
>> # ps ax |grep -i cvs
>> 1057 pts/2 S+ 0:00 grep -i cvs
>> 28728 pts/3 S+ 0:00 ssh amares...@cvs
>>
>> # ps axfj |grep -i cvs
>> 28076 30359 30358 28005 pts/2 30358 S+ 0 0:00 | \_
>> grep -i cvs
>> 28526 28728 28728 28437 pts/3 28728 S+ 0 0:00 \_
>> ssh
>> amares...@cvs
>>
>>
>> Help me , if i am wrong,
>>
>>
> I believe the above is wrong, in the context of the question asked.
> To me, hezjing asked how to see if `cvs login` had been done, so that
> scripts which are being written could check prior to making cvs calls,
> perhaps in the hope of not doing something wrong later in the script because
> of the repo not being available to the script.
>
> Assuming the user actually has a password on the server...
> Assuming the repository is using pserver (you really should use ssh)
> On a Unix machine the easiest way is to
> export xorpw=`grep "$CVSROOT" ~/.cvspass |awk '{print $3}'`
> if [ "$xorpw" != "A" ]
> then
> LOGEDIN=true
> else
> LOGEDIN=false
> fi
> echo $LOGEDIN
>
> I am not sure where CVSNT|WINCVS hide their .cvspass file.
>
> with ssh ...
> Assuming:
> A) $CVSROOT does not have a FQDN
> B) hostname on the server does not return a FQDN
> C) no username in $CVSROOT
> or
> D) both $CVSROOT and hostname will give you the same FQDN
> If the above assumptions are wrong then script around them, you are after
> all writing scripts. :)
> MACHINE=`echo $CVSROOT |awk -F: '{print $3}'`
> FROMMACHINE=`ssh $MACHINE hostname 2>/dev/null`
> if [ "$FROMMACHINE" == "$MACHINE" ]
> then
> LOGEDIN=true
> else
> LOGEDIN=false
> fi
> echo $LOGEDIN
>
>
>
>
> --- On *Wed, 4/2/09, hezjing <[email protected]>* wrote:
>> From: hezjing <[email protected]>
>> Subject: How to check if a user already login?
>> To: [email protected]
>> Date: Wednesday, 4 February, 2009, 8:21 AM
>>
>> Hi
>> I'm required to write a script to automate some CVS commands.
>>
>> Is there a CVS command to check if a user has already login?
>>
>>
>> One way to do this is to execute a CVS command (e.g. cvs log or checkout)
>> and observe the errors,
>> but is there a more elegant way?
>>
>>
>> Thank you!
>>
>>
>
> --
> Todd Denniston
> Crane Division, Naval Surface Warfare Center (NSWC Crane)
> Harnessing the Power of Technology for the Warfighter
>
--
Hez