Open edge 11.3 disconnect login

Posted by Steve Jones on 07-Oct-2015 03:02

Hiya

We have a scheduled task that runs as user stask01 which imports files into the database.

These usualy take a couple of mins.


How ever the stask01 id remains connected so through out the day there are multi sessions of the same user is.


Normally go into promon, shut downdatabase and disconnect the user 1 by 1. by using the usr number.

Thats after i stopped the task above from running otherwise would still be getting logins

Is there a quicker way to mass disconnect this user? say from the user id?

Point out very new to progress :(

So any help would be great

All Replies

Posted by James Palmer on 07-Oct-2015 03:51

Sounds to me like you need to get the code fixed that connects to the database so that it also disconnects when done rather than trying to fix it from a database perspective. I have maybe disconnected 2 users in the last 6 months and feel that's a bit much.

Posted by Steve Jones on 07-Oct-2015 03:55

3rd party sadly who have problems with this.. rarther annoying.. any idea of a work around as above?

Have to remove about 60 users a day (Of the same person)

Posted by Libor Laubacher on 07-Oct-2015 04:03

You can use the code from another thread you commented on few minutes ago and replace SYSPROGRESS with “your” username or if you are on Unix I suppose you can also use this
 
for in in `proshut dbname -C list | grep username | awk {'print $1'}`
do
proshut dbname -C disconnect $i
sleep 1
done
 
or write an equivalent in powershell if windows.
 

Posted by Steve Jones on 07-Oct-2015 04:10

Sadly using windows...

How do i execute that script from promon for promon to run it? Or as any one got a power shell version of the above please

Posted by Libor Laubacher on 07-Oct-2015 04:19

I am not sure I understand the promon remark. Promon is the script itself, which calls _mprshut (so does proshut).
 
Why don’t you use the zap.p from another thread then ? I believe all you have to do is to replace SYSPROGRESS there and then run it (prowin32 / _progres –db …. -p zap.p)
 

Posted by Steve Jones on 07-Oct-2015 04:37

ahh ok thankyou will give it ago.

Thank you for your help and patience

Posted by Steve Jones on 08-Oct-2015 04:29

yup i am rubbish at this....

How do i get the script to execute so that i can disconnect users with the above mentioned ID

Will point out i have had this lumbered onto my self with no formal training of progress so winging it atm so i apologise if i seem like a spanner at time.

Posted by Libor Laubacher on 08-Oct-2015 04:42

Steve,
 
the code you can use is here: community.progress.com/.../30693
 
You would need to replace SYSPROGRESS there with the username you wish to disconnect and then use client (prowin32/_progres to run it while being connect to the database and being on machine where db is).
 
/LL

Posted by Steve Jones on 08-Oct-2015 05:02

ok i have dropped the code into a text doc, stuck it as a file with ext as a .p

Dropped into progress navigated to our db then ran command promon ih (IH being name of our db)

now i get the usual options..

I run (prowin32/_progres) from power shell?

Posted by Libor Laubacher on 08-Oct-2015 05:22

There is no need for promon.
 
The code (zap.p) queries the _connect table to see who is connected and it will get their userids (of those users you want to disconnect) and then it will execute the disconnect on its own by calling proshut –C disconnect userid.
 
So save the code to something.p
 
Open ‘proenv’ on the database machine.
 
“prowin32 -db ih -p something.p”
 
Assuming you have development license there, if not you would need to compile it first into .r .
 
If you want to have it run automatically every XX hrs, then put it into .cmd/bat and schedule it from Task Scheduler.
 
I would also suggest to test it first on a test database with few users so you are sure that it does what it is supposed to do before you fire it up against production db.
 

Posted by Steve Jones on 08-Oct-2015 05:33

Ok done above and on our test db (I would get shouted at lots if i didnt)

Getting a progress box open saying :-

R-code file not located for "Zap.p" (473)

** unable to run startup procedure zap.p (492)

I have coped the zap.p file i created ito the same folder as the db location

Posted by Steve Jones on 08-Oct-2015 07:43

ahh add the -rx bit to it now getting can only compile encrypted

Posted by Steve Jones on 08-Oct-2015 08:03

now xcode locks up on me lol

Posted by Libor Laubacher on 08-Oct-2015 08:44

Compile the code on the machine where you have dev license (assuming you have one somewhere) and then deploy the .r onto your db machine.
 

Posted by Steve Jones on 09-Oct-2015 02:10

ok ran xcode got it encrypted i then run as above i then the procedure editor box open and it does nothing?

Posted by Libor Laubacher on 09-Oct-2015 08:57

It’s not supposed to do anything apart from disconnecting users. Perhaps the user you want to disconnect is not logged in ?
Can you paste the code here ?
 

Posted by Steve Jones on 09-Oct-2015 09:09

/* zap.p

*

* disconnect self-service users and remote clients with a given name, leaves APWs etc running.

*

*/

find _MyConnection no-lock.

for each _Connect no-lock where ( _Connect-Type = "SELF" or _Connect-Type = "REMC" ) and _Connect-Usr <> _MyConn-UserId and _Connect-Name = "stask01":

/*

 display

   _Connect-Id

   _Connect-Usr

   _Connect-Type

   _Connect-Name

   _Connect-Device

   _Connect-Batch

 .

*/

 os-command silent value(

   substitute( "&1 proshut &2 -C disconnect &3 >> /tmp/disconnect.&2.log",

     ( if opsys = "windows" then "call" else "" ),

     pdbname( 1),

     string( _Connect-Usr )

   )

 ).

end.

Posted by Libor Laubacher on 09-Oct-2015 09:46

Replace this os-command … line with
 
os-command SILENT value(substitute( "&1 " + os-getenv("dlc") + "/bin/proshut &2 -C disconnect &3 ", ( if opsys <> "unix" then "call" else "" ), pdbname(1), string( _Connect-Usr ))).
 
BTW – this assumes DLC environment variable is set, if not just put a path to proshut there.
 

Posted by Steve Jones on 12-Oct-2015 07:14

Hope you all had a good weekend

Anyway have done the change to the code above (Thank you) and it now works like a charm

So thank you once again for your patience and time very much appreciated :-0

This thread is closed