NPRao
30th November 2001, 20:36
Hi,
Is there any way that we can detect if a connection is dropped/lost so that we can kill the hanging sessions of the user when the user is on a dial-up or on a network.
Thanks!
JamesV
30th November 2001, 21:00
NPRao2000,
The answer depends on your platform, database and version of Baan. Let us know and maybe we can answer your question.
-- Jim
NPRao
30th November 2001, 21:04
Hi Jim,
We are using HP-Unix-11.0, Oracle-8.0, the latest BaaN 5.2 version.
Han Brinkman
3rd December 2001, 09:38
The ds_timeout_detect resource variable can be used. The bshell will check if the client is still reachable, if not the bshell will be closed and also free the licence.
Regards,
Han
henryt
3rd December 2001, 09:58
ls.,
In BGS in solution 110908 you can see how to setup this values.
HenryT.
Stephen Ruger
3rd December 2001, 16:48
there are also numerous third-party products that will monitor this and give you warnings, so the logoff does not always have to be automatic.
Stephen Ruger
Lodestar consulting
+1.215.785.6756
sr@mylodestar.com
victor_cleto
3rd December 2001, 21:23
shows that the ds_timeout_detect not always works, thus some bshells will remain open.
We use a custom script called from the ipc_info (replacing the bshell) that checks the allowed logins of a user. The user will tell us if he cannot login and we kill the 'old" processes.
Now, you can use this script to notify someone else or generate a message that the user has hunged processes as well!.
Also, for some systems (or all, can't remember) we make sure that at the end of the day (or at the beginning of a working day!) we kill all open bshells and get rid of locks (from oracle).
I think that there are better solutions out there ;)
NPRao
3rd December 2001, 22:04
Hi Victor,
can you let me know more details about ur custom script? do you mind to share your shell scripts?
Thanks!
victor_cleto
4th December 2001, 11:35
I'm not at the office yet but what we have is something like this:
all users connect using GUI and use bshell name: bshell, so they will use the custom script!
We have a $BSE/lib/nr_logins file that has lines like:
<username>:<nr_logins> eg:
bsp:10
tools:1
...
On ipc_info we use bshell pointing to a custom script bshell_logins.ksh
We created a $BSE/bin/bshell_logins.ksh that does something like:
USER='whoami'
ALLOW=gets nr. logins for this $USER from $BSE/lib/nr_logins
CURRENT=gets nr. existing bshell_logins.ksh running
compares ALLOW with CURRENT and
if
CURRENT<ALLOW the user can start another bshell
else
send a message to existing bshell's that user has exceeded allowed logins (or other thing you may want to add here).
I'll get a general example of a script as soon I'm in the office...
You can also create a ba6.1 script using the same principle (rename ba6.1 to ba6.1org or something) that does something similar and then calls the ba6.1.org so that you also apply the same priciples to users that connect using telnet OR make sure that the users use a menu when they login to allow them to change password and run ba6.1 only, otherwise any user that access Baan with ASCII is able to start inlimited ba6.1's.
NPRao
4th December 2001, 19:42
Hi Victor,
I will look forward to your solution for number or logins restriction.
But I am also looking at our problem, which is - how can we detect if a connection is dropped/lost so that we can kill the hanging sessions of the user when the user is on a dial-up or on a network.
victor_cleto
4th December 2001, 22:14
of a custom script that checks for allowed logins and sends a message to already open bshells from a user.
The LOGIN_FILE should be something like:
bsp:10
root:1
tools:1
<username>:<nr_allowed _logins>
#!/usr/bin/ksh
# NOTICE: You may need to replace manually the THIS_SCRIPT with the name of your script!
# Environment variables here - add TWO TASK, ORACLE_SID, whatever is needed in this section
BSE=<path_here>
LOGIN_FILE=<logins_file>
# The next is needed to send parameters to the "normal" bshell
LOGIN_PARAMS=$*
# Other
THIS_SCRIPT=$(basename $0)
USER='whoami'
typeset -i CURRENT_BWS ALLOWED_LOGINS USER_PID
# Check how many times user is logged in, in ASCII and GUI !
CURRENT_BWS=`ps -ef | grep ${THIS_SCRIPT} | grep -i ${USER} | grep -v "grep ${THIS_SCRIPT}" | 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
# 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
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
sanjayroongta
5th February 2003, 12:02
Dear Victor
I am trying your custom script. But it's given error. First I explain you my setup. We are running BaaN4c4 on Solaris 8 along with Oracle 8i database with 135 licenses.
I make a file allow_login and also a new script in name of baanusr in /usr/home/rsanjay. Whenever I run script through OS with following command :
# sh baanusr
it's given this error : "baanusr: systax error at line 5: 'baanusr-$' unexpected" on line "baanusr=$(basename $0)"
please let me know what is wrong with script. I am not getting meaning of basename.
rgds
Sanjay
patvdv
5th February 2003, 12:58
Replace the $( ) construct by backquotes: ` `
$( ) is a korn shell thingy and you are using sh
sanjayroongta
6th February 2003, 11:44
Hi Mr Patrick
After resolving above error. Now error is typeset: not found. Is rescripting required to run in sh.
what is wrong again.
rgds
Sanjay
patvdv
6th February 2003, 12:05
Yes, you have to leave out the line with 'typeset' as well. The best thing to do is to see if you have KSH on your Solaris system and replace the first line with the location of ksh on your system. Most Solaris systems that I know do carry Korn Shell by default.
garias
11th May 2003, 00:18
[I review that you have a special shell script to validate if the number of login for a user in baan,
I have a similiar shell script, but in dont use the bshcmd6.? to send de message, because its possible that its the first login of a user, And i want that the user don“t login.
I use:
exec $BSE/bin/bshell6.2 "$@" tccomloginerr
where tccomloginerr is a customize session that show a message, wait for a few seconds and after logout.
This work fine, but if we have users with a special DEM menus (enterprise modeler menus generated), the line:
exec $BSE/bin/bshell6.2 "$@" tccomloginerr dont work, and the user login in baan an see his special DEM menu. We cant control the number of logins for a this type of users ???
have any idea ??
Moderator comment: this particular DEM issue is beeing discussed on thread http://www.baanboard.com/baanboard/showthread.php?s=&threadid=9426
bferro
28th May 2004, 21:12
Hi Victor,
I tried your script to limit the number of times a user can log into Baan but I seem to have a problem. If I have an entry in the logins file everything works fine but if the user is not in the file, the "if [ -z ${ALLOWED_LOGINS} ]" doesn't seem to test correctly and the variable never gets set to 1. Any idea what could be wrong? The script works great otherwise.
Thanks,
Bob
patvdv
28th May 2004, 21:35
Bob,
You can fix this by:
1. For KSH/Posix Shell:
if [[ -z ${ALLOWED_LOGINS} ]]
then
...
fi
2. For other shells:
if [ "x${ALLOWED_LOGINS}" = "x" ]
then
...
fi
bferro
28th May 2004, 21:43
Hi Patrick,
Thanks for responding. I tried the double [[ ]] and it still does not work. I echoed the variable in a file and it is= 0. I get a "boot failed of user xxx" msg. If I add an entry in the logins file, the user can log on only the number of times set in the file. I am using ksh script.
NPRao
28th May 2004, 23:12
For ksh try this -
hrs=`echo $proctm | awk -F: '{printf $1}'`
mins=`echo $proctm | awk -F: '{printf $2}'`
secs=`echo $proctm | awk -F: '{printf $3}'`
if test -z "$secs"
then
secs=$mins
mins=$hrs
hrs=0
fi