Operating System - HP-UX
1848854 Members
8166 Online
104038 Solutions
New Discussion

Shutting down Interactive sessions to run database process

 
SOLVED
Go to solution
Brett Penza
Occasional Advisor

Shutting down Interactive sessions to run database process

I am looking for a way to stop all the user terminal processes so that they cannot lock up files, in order to run some unattended nightly processing. I am running AVANTE on a Unidata database. We run a nightly MRP process. Often files will be locked and the nightly process blows up. If I could come up with some way of shutting down all the interactive user sessions prior to running the nightly process, I could prevent this from happening. I could shut down unidata, but then nothing will run (even the nightly process). Is there something I could do with the "ps" or "kill" to stop only the user screens ? I do have a method of shelling out to running unix commands from the AVANTE System. I just don't know what command to run. Any ideas welcome Thanks.
2 REPLIES 2
Praveen Bezawada
Respected Contributor
Solution

Re: Shutting down Interactive sessions to run database process

Hi
To kill all the user terminal you can do something like

PIDS=`who -T | grep -v root | awk '{ print $8 }'`

for eachProc in $PIDS;do
kill -15 $eachProc
done

if you want not to kill someother users include them with grep -v options
like
who -T | grep -v root | grep -v otheruser

...BPK...
Paula J Frazer-Campbell
Honored Contributor

Re: Shutting down Interactive sessions to run database process

Hi Brett

This is somthing I do on a regular basis.

Create a stripped down passwd, mine is called passlock and contains only root and system entries.

Also create a user clear up script:-

who -u | grep | awk '{print $7}' | xargs kill

As my users are in groups I can pick them off by this method.

To Zap them all then:-

who -u | awk '{print $7}' | xargs kill


At routine start time :-

cp /etc/passwd /etc/passback
cp /etc/passlock /etc/passwd

The users now cannot log in.

Run your clear users commands (as above).

Run your process clear commands:-

ps -ef |grep | awk '{print $2}' | xargs kill

Then carry out your MRP process.

When finished :-

cp /etc/passback /etc/passwd
(lets the users in)
and restart processes.

HTH


Paula



If you can spell SysAdmin then you is one - anon