Kill pids from users with restrictions

Hello experts,
I would like to create a small script for my fedora core 1 server.

I have about 6 users and each user has different type of accounts,
Meaning that user1 can only run 4 pids and user2 only 1 pid etc..

Is there anyway to make a script that if user1 exceeds the limit to kill
his last pid?

thanks
XtryAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

surya_prabhakarCommented:
those pid's relate to what process ...?
this is tricky there may be many background process which will be running under the user1 etc
how do the users login to the machine .

please update .

surya.
0
XtryAuthor Commented:
yes normally I do 'addduser username'
then they have acces through SSH on the shell
and they can run their processes from there.
0
surya_prabhakarCommented:
There is a better way of restricting number of process on the system for a user
there is a file called  /etc/security/limits.conf

open this file and add an entry like this at the bottom

user1     hard    nproc    4

add this before End of file line .

IF you spend 2 minutes reading this file you can play with it .
Once you save the file the restrictions are in force immediately .

surya.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

surya_prabhakarCommented:
Are you able to try this?
0
wwanyhowCommented:
Surya,

You mentioned: "those pid's relate to what process ...?
this is tricky there may be many background process which will be running under the user1 etc
how do the users login to the machine ."

Is there a way to distinguish the background processes still running under user1 so we can kill the non-background processes?

I'm researching for a way to do that in AIX or Linux; any advice will be helpful, thx.
0
wwanyhowCommented:
Surya,

You mentioned: "those pid's relate to what process ...?
this is tricky there may be many background process which will be running under the user1 etc
how do the users login to the machine ."

Is there a way to distinguish the background processes still running under user1 so we can kill the non-background processes?

I'm researching for a way to do that in AIX or Linux; any advice will be helpful, thx.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.