Working on a job I was asked get a simple script to perform the following task and would like to ask for some help. I'm looking forward to learning more and diving deeper into the World of Open Source servers.
I need a script for a Unix server, using as few lines as possible, that generates a list of users that have active processes on a server and the number of processes for each of those users.
I know the basic scripting and syntax of creating structured code creation as I had to take a bunch of programming classes in college, and have created many batch apps in the command line world.
I'm assuming there is a show process command, and for some reason I want to say it's something like sho usr or close to that.
If it was commented out that would be really great too.
Would someone please be so kind to assist me or have an old one lying around?
Many thanks in advance for your consideration,
Mo-
I understand most of what is happening, however could you let me know If I'm interpreting your example correctly?
ps, by itself, shows you information about only your processes. To learn more about all of the processes that are running, use the -ef options with the ps command.
I understand most of what is happening, however could you let me
know If I'm interpreting your example correctly?
Can you show me an example of your output? I'm at home and can't try it myself. I would be very appreciative.
I realize I'm being a pain, however If you can I'd be very happy.
Many thanks,
Mo-
---------- Post updated at 10:32 PM ---------- Previous update was at 10:16 PM ----------
If I was going to be contructing this in good form:
I thought it might look something like what I started below and commented out so even a newby like me can quickly look at it and see what is happening.
I like to have the output be formatted in a manner that is a little more self explanitory.
Can you let me know if I'm on the right track? Am I missing something fundamental? Am I doing something stupid? All assistance is most welcome.
Thanks,
Last edited by pludi; 03-02-2010 at 02:41 AM..
Reason: code tags, please!!!
I get the users who have the processes by the command sequence "users | tr ' ' '\n' |uniq".The command "users" will give the user name with some process.Then I align the output and get the result as all the users.
like ,
karthigayan
aaa
bbb
ccc
....
....
The using the user name I get the number of process running for the users by using the "ps -U $name | wc -l".
The reason for removing the count is by one is that the ps will give the output with its header.
Hi,
I need to list out the processes which are started/restarted today in my Solaris box. If not possible need to convert the process uptime in minutes or seconds and compare it with a configurable value to list out those process ids for further processing in my scripting.
Can any one guide... (7 Replies)
Hi,
I have four tomcat instances named PNK, PNK1, PNK2, PNK3.
All are running on the same server.
To kill tomcat instance I usually do below for PNK1,PNK2,PNK3
kill -9 `ps -ef|grep tomcat|grep PNK1|grep -v grep|awk '{print $2}'`
But the above command does not work for PNK. Can some... (7 Replies)
if I want to create a bundle of user ids on some aix servers, if there is a way not need to do "passwd username" one by one user to set the password?
Thanks (3 Replies)
Please help me with this question
I have a tantan.sh under /home/mydir which is a caller to another script "tantan.sh" under /home/anotherdir
-----------------------------------------------------------
/home/mydir/tantan.sh
------------------------------------------------------------... (6 Replies)
Hi,
I need a script to kill the process Ids for the user ABC.
I prepared the following script after that while logging with user therough script i am not sure how to pass the user name and password.Can ou modify the script and help me out.
#!/bin/bash
for filesize in $(ls -ltr | grep... (4 Replies)
Hi All
what is the command to check process ids , which are running from long time and which are consuming more cpu?
Also how to check, what a particular PID is running what
For Ex:
i have a pid :3223722 which is running since from long time,
if i want to check what is this... (1 Reply)
Hi all,
I need a script that will loop around all the current processes and take a pmap -x <process id> and output each pmap to a separate file.
Would anyone have a quick command to do this? (2 Replies)
Hi
I have to validate the user ids. It should be numeric. I am using following code
echo $input | grep '^\{11\} > /dev/null
if
echo "error"
else
echo "Success"
fi
But when i entered user id as 828^&% the output is
8565
8566
-bash: ^: command not found
Means when i entered... (4 Replies)
Hello All,
I need to track the exact process ID related to a particular application running on HP-UX machine. i.e. the exact functionality of fuser unix command.
fuser application.log // It gives the exact process ID for application.log
Since there is no provision for 'fuser' in HP-UX... (13 Replies)