vishbaan
26th April 2004, 09:29
dear fnds

we have a problem of distributing licenses per company in baan server.

In one server (baan logic, baan license, db), and it is licensed for 30 users . we have three LIVE companies C01, C02, C03
(C01 : 10 users; C02 : 15 users; C03 : 5 users and so are the licences they use and pay for)

Now how to make sure C01 uses only 10 licenses and C03 uses only 5 licenses...

any ideas friends..

VISH

Darren Phillips
26th April 2004, 10:59
you can edit ipc_info to start the executable or script of your design write your logic in there to determine if they can start a bshell based on user name or department membership.

vishbaan
26th April 2004, 18:07
hi Darren Philips

can you give some more details on your points on this ipc_info or scripting the logic.

1) you said to edit ipc_info file:
I found the ipc_info(in the server $BSE\lib) file has something like the following:

bshell s 0 0 s ${BSE}\bin\ntbshell.exe

msql7 s 0 0 p ${BSE}\bin\msql7_srv.exe

what should I edit on the ipc_info file which apeears as bove, can you give some details.

OR

2) to script the logic to determine C03 only 5 users can login or C01 coy only 10 users can login. How to do this, can you give some sample scripts pls.

Thanks and best regards

VISH

Darren Phillips
26th April 2004, 23:57
Q1


bshell s 0 0 s ${BSE}\bin\customlogon.exe

http://www.baanboard.com/baanboard/showthread.php?s=&threadid=6363&highlight=logins

you can see the thread above that you cannot run a batch file from ipc_info under windows I should have remembered that. You need to write a small vb app to do the job (this is a lot easier under UNIX as you can call a shell script)

Q2
if you create three security groups in windows e.g c01 c02 c03 and place the users in their groups you can identify group membership. you can call licom -w to tell you who is logged. use vb code to query sams database if NT or active directory as to the group membership of the currently logged on users the results from this tell you if the group has reached it's limit if not you launch the ntbshell.exe


I realise this is very high level I don't have any sample code as I have never needed this

this link gives examples on using adsi to check group membership

http://authors.aspalliance.com/brettb/WindowsNTGroupBrowser.asp

vishbaan
27th April 2004, 08:48
hi Darren Philips,

tks for your good efforts.

I think the solution is complex in NT. I liked to address it from within Baan or atleast at a batch file level.

Anyway let us wait if something more can come up on this

thanks once again

VISH

vishbaan
16th September 2004, 11:15
hi

just give it a life back.

we have users assigned companywise; we have licences per company; common baan server.

we want to control the no. of log-ins per company.

is there a way to know from baan tools tables or files the current users logged-in so that we can run a script to see users linked to a company and restrict the log-in as a start-up session.

thanks for ur help

VISH

Hitesh Shah
16th September 2004, 15:53
We have done this on unix . But not sure for win2k. However u can try some hints for scripts.

If the company numbers are set at BWC level, u can check the variable BSE_COMPNR .

Alternatively u can check the variable $LOGNAME & $USER and the files $BSE/lib/user/u$USER to get company number and then have your script algo for determining the licence allocation.

vishbaan
19th September 2004, 09:32
hi Hitesh

say, I have the users by Coy; I have a custom table where-in I have no. of license per coy.
from tools table

Coy User
=== ====
100 user11
100 user12
100 user13

200 user21
200 user22
...... and so on

another custom table
Coy no. of license
==== ==========
100 5
200 3

now a start-up session to see a list of users already logged-in (I DONT KNOW HOW TO DO THIS; would u throw some light on this pls)
is there a command or area from which I can know the list of users. I will check if the log-in is permitted if not I will log the user off (THIS ALSO HOW TO DO...?)

If can do the above then I can control the no. of license / log-ins per Coy from with in Baan.

thanks for ur help

VISH

Hitesh Shah
20th September 2004, 07:18
Hi Vish

U need to adopt an approach whereby you determine whether login is allowed to user or not before user gets into baan. In the approach u listed, user first gets into baan and then the startup program determines about loging status. However I dont know how to kill the bshell (bshcmd.exe -k bshell.pid() ??) .

The preferred approach as others pointed out and even I recommend is to adopt ipc_info route wherein you run an exe or batch file with winscripts and determine the login status and execute the bshell.exe if the login is valid in that script itself.

We have unix and korn shell script which wont' be of any help on Windows.

manojsharma
21st September 2004, 10:10
:) Hi Hitesh,

We have also have the similar problem, we are working on Sun Solaries, DB is Oracle, BaaN 4c4. We have created a shell script which checks & allow user to logged in as per max. login allowable but when we add this shell script in ipc_info, it is not executed.

Can you please paste your script.

Thanx in advance.

Hitesh Shah
21st September 2004, 16:39
U have to add first line as indicator of the shell to use like

#!/bin/ksh (for korn shell).

Then with appropriate executable permissions to the script , it will definitely work.

Post more details about the script if it does not work.

NPRao
21st September 2004, 18:53
Vish,

now a start-up session to see a list of users already logged-in (I DONT KNOW HOW TO DO THIS; would u throw some light on this pls)
is there a command or area from which I can know the list of users. I will check if the log-in is permitted if not I will log the user off (THIS ALSO HOW TO DO...?)

You can have the startup program in BMS mask data - ttadv4188m000, do your checks and then use the BaaN functions - pstat() and kill() and kill all the processes belonging to a user to disconnect him.

Good Luck

manojsharma
22nd September 2004, 08:48
I am posting herewith the script

#!/bin/ksh
LOGIN_FILE=/usr/home/rsanjay/allow_login
LOGIN_PARAMS=$*
USER=`(who am i | cut -c1-8)`
echo $USER
CURRENT_BWS=`(licmon6.1 -w | grep $USER | wc -l)`
echo $CURRENT_BWS
ALLOWED_LOGINS=`grep -i ${USER} ${LOGIN_FILE} | cut -f 2 -d ":"`
echo $ALLOWED_LOGINS

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

if [ ${CURRENT_BWS} -le ${ALLOWED_LOGINS} ]
then
/usr4/ban4c3/bse/bin/bshell6.1 ${LOGIN_PARAMS}

else
ps -ef | grep bshell | grep ${USER} | cut -c 10-14 | while read USER_PID
do
echo $USER_PID
/usr4/baan4c3/bse/bin/bshcmd6.1 -M "Warning ! you are only allowed to login ${ALLOWED_LOGINS} time(s)! Please close this window" -u 1 -w 1 ${USER_PID}
done
sleep 5
fi

best regards

Hitesh Shah
22nd September 2004, 17:54
Hi Manoj,

Does ur users have only only 8 characters. U can also try the $LOGNAME variable for user name . Also start the bshell6.1 with argument $* instead of login params. Further u don't get the messages in BW windows when programmed through shell script . Further u have not set the $BSE & $PATH. Possible that licmon6.1 -w does not run successfully.

Did u run the file manually.Is it giving proper echo on the screen.

I have some problem here attaching the script (probably due to our firewall setup), I'll upload the script once i check with firewall vendor.

Hi NP,

Is there any sequence one should follow killing processes . For example if process init or ottstpstdlib gets killed before other processes. Definitely pid must be the last to be killed .

NPRao
22nd September 2004, 20:01
Is there any sequence one should follow killing processes . For example if process init or ottstpstdlib gets killed before other processes.
Hitesh,

I did the top to down killing [process ids in ascending order, process id tree generated from the pstat() ] and killed the current process last. It works fine for me.

vishbaan
23rd September 2004, 18:15
dear Mr.NPRao,

Quote:
You can have the startup program in BMS mask data - ttadv4188m000, do your checks and then use the BaaN functions - pstat() and kill() and kill all the processes belonging to a user to disconnect him.

Will u pls clarify answer the following pls.

1) what is BMS(ttadv4188m000) data used for; if I add the start-up program to BMS what is attained.

2) pstat() function I could not get see it in the HELP for syntax.
In the script while compiling it gives error as
"3 arguments expected for pstat() function"

best regards

VISH

vishbaan
23rd September 2004, 18:18
dear Mr.NPRao,

Quote:
You can have the startup program in BMS mask data - ttadv4188m000, do your checks and then use the BaaN functions - pstat() and kill() and kill all the processes belonging to a user to disconnect him.

Will u pls clarify answer the following pls.

1) what is BMS(ttadv4188m000) data used for; if I add the start-up program to BMS what is attained.

2) pstat() function I could not get see it in the HELP for syntax.
In the script while compiling it gives error as
"3 arguments expected for pstat() function"

best regards

VISH

NPRao
23rd September 2004, 19:23
Vish,

You can use the Search option on the Board to find some answers.

1) what is BMS(ttadv4188m000) data used for; if I add the start-up program to BMS what is attained.

Refer to - Sending broadcast message in GUI (http://www.baanboard.com/baanboard/showthread.php?t=5634&highlight=BMS)

2) pstat() function I could not get see it in the HELP for syntax.

Refer to - pstat() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_processes_pstat)

You can use the Search option to see some examples in the forums.

manojsharma
24th September 2004, 12:24
Hi Hitesh,

Now its works perfectly for ascii login but in gui, baan get hang-up.

Please suggest as we are quite near to the solution.

Hitesh Shah
24th September 2004, 13:09
Initialize all variables in ur user profile and global profile (/etc/profile) in the shell script.May be this helps.

sanjayroongta
24th September 2004, 14:25
Hi Hitesh

R u talking about variables used in script i.e. "LOGIN_FILE, LOGIN_PARAMS, CURRENT_BWS, ALLOWED_LOGINS, USER_PID".

Please let me know how to initialise the same in /etc/profile. Is also require to restart application.

If possible pls send me your script on sanjayroongta@yahoo.com.

Is also at your end, clients are windows and connected through Rexec over port 512.

rgds

Hitesh Shah
24th September 2004, 15:10
I meant that there may be some variables in the user individual profile and global profile like BSE , BSE_TMP , PATH etc . Put these variables also in ur wrapper shell script. At the time of starting in ASCII these varaibles are already having right values (from these profiles) which may not be the case when running under BW.

Our setup also is same. Clients are windows and connected through Rexec over port 512.

manojsharma
25th September 2004, 07:43
Hi Hitesh

As per my knowledge, variable initialisation not required in .profile in case of BW but yes when user take baan ascii login then in .profile BSE BSE_TMP etc variable should be properly initialise.

Anyway I initialise all variable BSE BSE_TMP PATH ORACLE_HOME ORACLE_SID etc after #!/bin/ksh but problem not resolved. After click on BW exe, only startuplogo appear after that nothing to happen.

I don't know where we are wrong.

rgds


NP : Your personal intervantion required pleaseeeeeeeeee.

dave_23
25th September 2004, 13:44
Hi Hitesh,

Now its works perfectly for ascii login but in gui, baan get hang-up.

Please suggest as we are quite near to the solution.

Are your "echo" statements still in the script? try removing them,
I don't think the BW can handle that well.

Dave

manojsharma
27th September 2004, 14:50
Hi Hitesh

I tried your script also but unable to through.

After executing line by line I found $LOGNAME could not return any thing.

echo $LOGNAME > $HOME/tmp_login
or
USER=$LOGNAME
echo $USER > $HOME?tmp_login

in tmp_login only a blank record is saved.

I am totally confused. Pls help why system not returning anything.

BUT when I execute through ba6.1, every thing executing perfectly.

I don't know what is wrong with bw.exe (client window 98)

rgds

Hitesh Shah
29th September 2004, 08:19
No idea why logname does not return value . U can try to trap $HOME variable if it has the user name .

Also post your latest script . Maybe someone can suggest any changes instantly.

Markus Schmitz
29th September 2004, 10:52
Logname is often not properly set, if GUI is used.

Use the commad "id" instead. This always works:

export LOGNAME=`id | cut -f 1 -d ")" | cut -f 2 -d "("`


regards

Markus

NPRao
29th September 2004, 20:32
Manoj,
After executing line by line I found $LOGNAME could not return any thing.
If LOGNAME does not work try to use the $USER variable to get the user login.
variable initialisation not required in .profile in case of BW but yes when user take baan ascii login then in .profile BSE BSE_TMP etc variable should be properly initialise.
I think the .profile is not executed when you are logging in from the GUI. If you are inside the BW/Worktop and you like to get the path/settings etc from your .profile you need to explicity execute the .profile.

Based on your posting -
In one server (baan logic, baan license, db), and it is licensed for 30 users . we have three LIVE companies C01, C02, C03
(C01 : 10 users; C02 : 15 users; C03 : 5 users and so are the licences they use and pay for)
This solution is not fool proof if a user has all company access authorization. If the users are always tied up to a single company and not allowed to change company then you can always use the BMS mask program to call a shell script to check which users are logged into the system then check them against Tools User Data and then check your custom table for the number of allowed licenses per company, to be connected or disconnected.
This will avoid complexity and also works in both the cases of ASCII or BW/GUI interface.

manojsharma
30th September 2004, 12:46
Thanx all

Specially NPR & Hitesh for their valuable support.

Now its working fine.

regards

Manoj Sharma & Sanjay Roongta