ancyrae077
10th May 2002, 10:48
Hi,
Do you know any way to limit for a user logging to Baan. i.e. One user can use only one user licence concurrently.
Regards.

victor_cleto
10th May 2002, 11:59
Any implementation of restrictions will depend on what OS you are using.

In UNIX you can create a script that it is called from ipc_info (your BW configuration must point to this one instead of the standard bshell) and this script will check if the user already has a connection made. If it has, then do not allow to connect. If it has no connection, then call the "real" bshell.

In NT, this can be feasible but you must do the same using a programming language and compile it (generate a .exe file) that it is called from the ipc_info and does the above.

By the way, I have posted already an example script for UNIX in this thread: http://www.baanboard.com/baanboard/showthread.php?s=&threadid=516&perpage=5&display=&pagenumber=1

telgar
30th May 2002, 21:08
There is a 3rd party software that works very well, it is called CloseIdle. You just set how many times that a user can log in and it will not allow them to start another instance.

This also will shutdown a users bw if they don't do anything within Baan within the time limit that you set.

nizamudeen
8th June 2002, 16:33
Hi victor,

I followed yr instyructions and created a shell script in UNIX and modified the ipc_info file .But it allows the same user to login more than once

What i have done is

1. Created a shell scirpt by name "baanusr" as below:

umask 007
LOGIN_FILE=/baan/bse/home/bsp/allow_login

# The next is needed to send parameters to the "normal" bshell
LOGIN_PARAMS=$*

# Other
baanusr=$(basename $0)
USER=`whoami`
typeset -i CURRENT_BWS ALLOWED_LOGINS USER_PID
echo "baanusr - "$baanusr $0 $USER

# Check how many times user is logged in, in ASCII and GUI !
CURRENT_BWS=`ps -ef | grep ${baanusr} | grep -i ${USER} | grep -v "grep ${baanusr}" | wc -l`

# Compare the current number of Logins with the allowed number
# If current number < allowed number : start Bshell
# If current number >= allowed number : whatever you want - here we send a message to him

ALLOWED_LOGINS=`grep -i ${USER} ${LOGIN_FILE} | cut -f 2 -d ":"`

# No logins
if [ -z ${ALLOWED_LOGINS} ]
then
ALLOWED_LOGINS=1
fi

echo "USER PID " $USER_PID
echo "LOGIN_PARAMS " $*
echo "CURRENT_BWS " $CURRENT_BWS
echo "ALLOWED_LOGINS " $ALLOWED_LOGINS
# One or more already loggins
if [ ${CURRENT_BWS} -le ${ALLOWED_LOGINS} ]
then
${BSE}/bin/bshell6.1 ${LOGIN_PARAMS}
else
# NOTICE: on HP-UX a ps gives an output like "xxxxxxxx xxxxx ..." = username[8]
pid[5] ...
# Sends a message to all open bshells for the user (ASCII and GUI)
ps -ef | grep bshell6.1 | grep -i ${USER} | grep -v "grep bshell6.1" | cut -c 10-14 | while read USER_PID
do
/baan/bse/bin/bshcmd6.1 -w1 -u1 -M "Warning: you are only allowed to login ${ALLOWED_LOGINS} time(s)! Please close this window" ${USER_PID}
done
sleep 5
fi

2.created a file "allow_login" mentioning the number of logins each user is allowed for

3. Modified the ipc_info and called this "baanusr" script in the begining

But when i login twice using the same user name, i am not getting the desired result (it allows me to login "n" number of times

If i run the script from #ksh, i get the below message

Please start the user interface or enter any valid options (use -? for options)

Can any one help and tell me where i am going wrong ?


:confused:

Regards

Han Brinkman
8th June 2002, 21:38
Hi,

Guess you have to do a little debugging.

Try putting statements in the scripts that write e.g. the variables in a file which you can check. By this it must be possible to find out what's going wrong.

Regards,
Han

nizamudeen
9th June 2002, 17:54
Hello,

I did debugging and almost got through. If i run the shell script from the OS, it is working fine.

Now i am struck up here :-

during logging in, when the ipc_info file is called, i get Error no :8
(which is related to magic number)

The error log of ipc_boot6.1 is below:


2002-06-09[17:36:59]:E:bsp: ******* S T A R T of Error message *******
2002-06-09[17:36:59]:E:bsp: Log message called from /port.6.1c.05.01/vobs/tt/nw/
ipc_boot.c: #385 keyword: user
2002-06-09[17:36:59]:E:bsp: Pid 15944 Uid 125 Euid 125 Gid 125 Egid 125
2002-06-09[17:36:59]:E:bsp: user_type S language 2 user_name bsp tty locale ISO
88591/NULL
2002-06-09[17:36:59]:E:bsp: Errno 8 (Exec format error) bdb_errno 0
2002-06-09[17:36:59]:E:bsp: Log_mesg: Can't execv /baan/bse/bin/baanusr (errno =
8)
2002-06-09[17:36:59]:E:bsp: ******* E N D of Error message *******


And in the script (provided by victor), there is a parameter as
LOGIN_PARAMS=$*

What login parameters are needed for bshell ?
Can any one help me ?


Regards

victor_cleto
9th June 2002, 21:08
Has the script the executable flag on? (I never saw an error type 8 before...), it must have the same permissions as bshell.

Regarding the LOGIN_PARAMS, this is needed to store any additional parameters that you may pass into the bshell from the BW (like "-- -set BSE_LANG=2", etc.).

nizamudeen
10th June 2002, 09:15
Hi victor,

Yes, the script does has the executable flag

In the ipc_info file, i am calling this script (baanusr) first. If it satisifies the conditions in the script, i am calling the "bshell6.1"

My ipc_info file is like this


# more ipc_info
baanusr s 0 0 p ${BSE}/bin/baanusr
bshell.inst s 0 0 p ${BSE}/bin/bshell_inst6.1
sh_server s 0 0 s ${BSE}/bin/sh_server6.1
audit s 501 510 p ${BSE}/bin/audit_srv6.1
fs6.1 s 303 335 m ${BSE}/bin/fs6.1
nserver s 0 0 s ${BSE}/bin/nserver6.1
bisam s 307 370 p ${BSE}/bin/bisam_srv6.1
btam s 307 370 p ${BSE}/bin/btam_srv6.1
informix s 305 350 p ${BSE}/bin/inf_srv6.1
oracle7 s 302 320 p ${BSE}/bin/ora7_srv6.1
oracle8 s 302 320 p ${BSE}/bin/ora8_srv6.1
sybase s 309 390 p ${BSE}/bin/syb_srv6.1
db2 s 310 301 p ${BSE}/bin/db2_srv6.1


Is this ok ?

Regards

victor_cleto
10th June 2002, 13:15
The ipc_info looks ok, add

#!/usr/bin/ksh

in the first line of your baanusr script, maybe exec does not know what to use to run it?
And to tackle all possible problems of executable flags, do a chmod 777 baanusr

Han Brinkman
10th June 2002, 13:56
It looks to me that your script is not executable.

Han

nizamudeen
10th June 2002, 17:32
Hi,


I tried all ways, but it is not working when i call this script through ipc_info.

The script was working fine when it is called from the Unix and this gave me a idea

Now i am running this shell script every 30 minutes as a cronjob in UNIX so that it will check for multiple / duplicate logins and sends message to those users asking to logout.

My requirement is partially fulfilled !

Thanks to all those who gave their inputs...


Regards

Han Brinkman
11th June 2002, 09:37
I have implemented these scripts before as Victor has.

I noticed that you changed the bshell line to baanusr, however this means that you have to change your bwc as well!

I would recommend to keep the same name however not calling ${BSE}/bin/bshell6.1 but your own script.

Regards,
Han

chjagge
24th July 2002, 17:51
This applies to UNIX only. We have this currently running in our environment. We've tested two methods. Directly in UNIX via the .profile and a script called from the ipc_info. Using the script only you can count the # of bshell and limit the user if they exceeded the predefined available concurrent bshells per user. What I've used is a combination of a UNIX shell script as well as a Baan dll called via the Baan C-Interface. This gives us far more flexibility. You can create departments, Company limits and run the logic within Baan and then fire out a flag back to the shell script to allow the user to login or not.

artjuh
4th November 2002, 16:55
i have almost the same problem.

When i start my script from unix it say's
"Please start the user interface or enter any valid options (use -? for options)"

and when i start it from BWC it say's in an BW messages window

1 : Received from ipc_boot: 'Can't get server info for test `
2 : Error : bw failed to connect to 10.31.10.107!test

(10.31.10.107 is server IP)

my ipc_info script looks like this
bshell s 0 0 p ${BSE}/bin/bshell6.1
bshell.inst s 0 0 p ${BSE}/bin/bshell_inst6.1
sh_server s 0 0 s ${BSE}/bin/sh_server6.1
audit s 501 510 p ${BSE}/bin/audit_srv6.1
fs6.1 s 303 335 m ${BSE}/bin/fs6.1
nserver s 0 0 s ${BSE}/bin/nserver6.1
bisam s 307 370 p ${BSE}/bin/bisam_srv6.1
btam s 307 370 p ${BSE}/bin/btam_srv6.1
informix s 305 350 p ${BSE}/bin/inf_srv6.1
oracle7 s 302 320 p ${BSE}/bin/ora7_srv6.1
oracle8 s 302 320 p ${BSE}/bin/ora8_srv6.1
sybase s 309 390 p ${BSE}/bin/syb_srv6.1
db2 s 310 301 p ${BSE}/bin/db2_srv6.1
test s 0 0 p ${BSE}/bin/login.ksh

and login.ksh like this

#!/usr/bin/ksh
${BSE}/bin/bshell6.1 $*

my log.ipc_boot6.1 say's

2002-11-04[15:43:08]:E:bsp: ******* S T A R T of Error message *******
2002-11-04[15:43:08]:E:bsp: Log message called from /port.6.1c.06.02/vobs/tt/nw/
ipc_boot.c: #339 keyword: user
2002-11-04[15:43:08]:E:bsp: Pid 18835 Uid 125 Euid 125 Gid 125 Egid 125
2002-11-04[15:43:08]:E:bsp: user_type S language 2 user_name bsp tty locale ISO
88591/NULL
2002-11-04[15:43:08]:E:bsp: Errno 0 bdb_errno 0
2002-11-04[15:43:08]:E:bsp: Log_mesg: Can't get server info for test
2002-11-04[15:43:08]:E:bsp: ******* E N D of Error message *******




Does somebody knows what could be wrong

jaapzwaan
4th November 2002, 17:46
In your BWC file, you probably have the word "test" for bshell. BW will look in the ipc_info file what executable is linked to "test" and none exists.

Regards,
Jaap Zwaan

artjuh
4th November 2002, 18:31
ive changed something's now it's starts the batch file.
but not all in it :)
it's very stupid like a little child that only takes the cranberry's out of an salad.
it does open the bshell6.1 but it doesn't echo a line to a file :)
what's in the samebatch file
my batch file looks a little like this.
#!/usr/bin/sh
#-------------
user=`\usr\ucb\whoami`
echo $user >> testfile.txt
bshell6.1 $*
#-------------

then it start's the bshell6.1 but doesn't echo the current user

Does somebody got an clue ?
When i start the process in Unix it says the following.
"Please start the user interface or enter any valid options (use -? for options)"
No more lines and then it does echo the user to that file.

I thought about maybe he started an other bshell6.1 but to make sure of that i renamed other bshell's

jaapzwaan
5th November 2002, 11:43
Artjuh,

Your testfile.txt is created in the current directory of the bshell process.
To avoid a search on you system where this might be, change the line in:
echo $user >> /tmp/testfile.txt
or some other absolute path.

To find out where the original lines have gone, add the following line too:
pwd >> /tmp/testfile.txt

regards,
Jaap Zwaan

artjuh
5th November 2002, 12:02
Thnx everybody who helped me .
finaly it works.

rgarts,
Artjuh

artjuh
5th November 2002, 17:11
Only thing that doesn't work jet is to send a message to users who are logged in.
bshcmd6.1 -w1 -u1 -M "Waarschuwing. U mag maar $allow x inloggen in BAAN!! Sluit AUB dit scherm en probeer het opnieuw" $USER_PID
That doesn't wrk
$USER_PID contains the PID's of the bshells who are logged in
with a simple while script.

It is not that importend for this to work because main goal is already accomplished but this would be nice to. for "User friendly stuff blablabla ;)" tnx

Artjuh

Ilansu
6th November 2002, 16:44
Dear Sir,
We have developed new software named Baan User Manager, I attached the user guide, i think this software answer all you demands
you can reach me at this address: yuvalf@applicom.co.il
regards,
Youval