1844185 Members
2485 Online
110229 Solutions
New Discussion

script help

 
Nick D'Angelo
Super Advisor

script help

All,

I was looking to create a script that would check for idle users for one of our sites, which I have: who -u|grep 10.2|sort -k6 .

However I wanted to use the output from the above command/script to query our db logs to see if they are indeed still logged into the database or not. There are too many users that do not logoff of the application and leave their sessions idle for hours, thus consuming a db licence.

There is no safe way to bump them off within the O/S, so I wanted to setup a script, that would look for idle users > 1 hour, then look in our /db1/data1.lg or /db1/data2.lg and then send them an email suggesting they log off.

The real masterpiece would be to write the offending user in a offender.log file in a directory somewhere.

Your help/ideas are appreicated.

Always learning
4 REPLIES 4
Nick D'Angelo
Super Advisor

Re: script help

Sorry, when querying the db logs, if the last entry in the log file for them says login (just as in this example)
12:19:30 Usr 5: Login by root on /dev/pts/tb. (452)

Then, we want to send them an email and write their userid with date/time in a log file.

Nickd
Always learning
Fred Martin_1
Valued Contributor

Re: script help

Is this a Progress databaase by chance? Just guessing, from the name of the log file.

If so, this command will tell you if a user is currently connected to the database:

$DLC/bin/proshut ${DBNAME} -C list

You'll need to grep for the specific user.

Again assuming Progress, you could get a list of Progress processes:

ps -ef | grep _progres

Cull from that the ones that have an idle time greater than your limit.

Then, using the Progress command above, find out if they are really connected to the DB.
fmartin@applicatorssales.com
Nick D'Angelo
Super Advisor

Re: script help

Fred,

Indeed a progress environment.

I will try it and let you know.

Do you have any other Progress scripts that you might be willing to share?

Thanks.
Always learning
Fred Martin_1
Valued Contributor

Re: script help

Unfortunately, no. The database vendor, in our case NxTrend, supplied the few starup/shutdown scripts and I haven't needed much else.
fmartin@applicatorssales.com