[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: User process killer script..



On Thu, Dec 27, 2001 at 12:44:38AM -0800, Petre Daniel wrote:

| I was thinking at a script run either from root's crontab that would check 
| all processes and if the users that started them are not logged in (here 
| i'm stucked) it would kill them all,or a inittab script that would be 
| spawned and the same thingie..process check and termination..
| Does anyone have any idea about some script that would perform such thing?

Yes, see below :

| At 12:01 PM 12/26/01 -0800, Karsten M. Self wrote:

| >One system comes to mind.  I'll outline it and leave implementation to
| >Petre.
| >
| >
| >   - /usr/local/etc/noremote:  file of users who can't run processes
| >     while not logged in.
| >
| >   - /usr/local/etc/noremoteprogs:  file of programs which can't run
| >     while the controlling user is not logged in.
| >
| >   - Get a list of currently logged in users.
| >
| >   - Get a list of processes belonging to users in the 'noremote' list.
| >
| >   - Get a list of processes belonging to the 'noremoteprogs' list.
| >
| >   - Scrub both process lists against currently logged in users.
| >
| >   - Kill what's left.
| >
| >Test thoroughly before deploying.
| >
| >Implement as a regularly scheduled cron job, say, every 10-15 minutes.

Karsten has just described here the steps the script will need to do.
He has written it here in english, but left translating it (correctly)
to shell to you :-).

The simplest thing would be a daemon to monitor system load and then
report to you if the load is too high, then you manually go in and
correct it.

-D

-- 

Trust in the Lord with all your heart and lean not on your own
understanding; in all your ways acknowledge Him, and He will make your
paths straight.
        Proverbs 3:5-6



Reply to: