Todd's solution is working, to check from the ~/.cvspass.
Post by Todd DennistonPost by Amaresh Chandra DasHi Hez,
Please use this bellow command ,
if someone is logged in then you will get message like " \_ ssh
# ps ax |grep -i cvs
1057 pts/2 S+ 0:00 grep -i 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
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 ...
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
Post by Amaresh Chandra DasSubject: How to check if a user already login?
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