1836451 Members
2413 Online
110100 Solutions
New Discussion

Re: Monitoring loggin

 
SOLVED
Go to solution
Bernd Dittmar
Advisor

Monitoring loggin

Hello,
i need a script for monitoring loggin accounts like this:

if used 'ps -ef | grep $LOGNAME | grep ba6.1 | wc -l' -ge 2
then
echo "Youre still logged in, please use this session"
sleep 5
exec logout 2> /dev/null
else
echo "I am starting application"
sleep 2
exec ba6.1
fi

But the obove script does not work, it allways uses the else.
But, if the user is logged in (the "ps...." is greater/equal 2), the exec logout must be executed.

Is there any idea ?
BaaN IV on HP-UX
4 REPLIES 4
Alexander M. Ermes
Honored Contributor

Re: Monitoring loggin

Hi there.
What about this URL ?

http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xacc2d06ed8c8d4118fef0090279cd0f9,00.html

Rgds
Alexander M. Ermes
.. and all these memories are going to vanish like tears in the rain! final words from Rutger Hauer in "Blade Runner"
harry d brown jr
Honored Contributor

Re: Monitoring loggin

change your "if" to this:

if test "`ps -ef | grep $LOGNAME | grep xterma |wc -l`" -ge 2

Live Free or Die
harry d brown jr
Honored Contributor
Solution

Re: Monitoring loggin

Sorry, replace xterma with your application name.

Live Free or Die
Andreas Voss
Honored Contributor

Re: Monitoring loggin

Hi,

hey, another BAAN user !

To prevent for multiple BAAN-Login-session you could use this:

if ps -fu$LOGNAME | grep ba6.1 | grep -vq grep
then
echo "Youre still logged in, please use this session"
sleep 5
exec logout 2> /dev/null
else
echo "I am starting application"
sleep 2
exec ba6.1
fi

Regards