Sponsored Content
Top Forums Programming parsing currently running processes Post 302092736 by blowtorch on Thursday 12th of October 2006 03:09:41 AM
Old 10-12-2006
Hi Hitori,
I don't want to know how to read the process details. I am doing that already. My program will have a list of, lets say, command lines patterns, that it has to match against currently running processes. It will do this in an infinite loop, raising alerts if any of the process patterns are not found in the list of running processes or if the number of matches are too few or too many.

It may have to go through the list of running processes every minute (maybe, depending on the configuration). So, my question is whether it would be better to create a list of command line entries from the /proc every minute and go through my list and match (the entire list of current processes would be processes for every entry in my list), or should I go through the all /proc entries for each of the entries in my list.

The first method involves creating a list of an unknown size but issuing the /proc reading commands (readdir, open, read, stat) just once. The second method requires the readdir, open, read commands to be executed for the entire /proc filesystem for each process pattern in my list.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running two processes in background

hi there, here's what i need in my korn-shell: ... begin korn-shell script ... nohup process_A.ksh ; nohup process_B.ksh & ... "other stuff" ... end lorn-shell script in plain english i want process A and process B to run in the background so that the script can continue doing... (6 Replies)
Discussion started by: jacob_gs
6 Replies

2. Programming

getting certain info for all processes currently running

i am writing a utility that displays information about all the running processes in the /proc directory. I do not know how to get the following information for each of the processes in the /proc directory: -effective user id -effective user name -effective group id -effective group name... (3 Replies)
Discussion started by: Yifan_Guo
3 Replies

3. Solaris

About running processes in background

Hi, I need to establish a procedure that will start an application in background each time my remote Solaris server is (re)started. This would be a kind of daemon. I am no sysadmin expert, so I am looking for pointers. How should I proceed? What are the main steps? Thanks, JVerstry (9 Replies)
Discussion started by: JVerstry
9 Replies

4. Shell Programming and Scripting

Need help with running processes script

I'm doing a script with the Shell. I need that it only show the number of running processes. Ex: echo "There are `command` running processes" Thnx! Pd: Sorry the idiom. I'm spanish. (2 Replies)
Discussion started by: Ikebana
2 Replies

5. Shell Programming and Scripting

Need help with running processes script

I'm doing a script with the Shell. I need that it only show the number of running processes. Ex: echo "There are `command` running processes" Thnx! Pd: Sorry the idiom. I'm spanish. (5 Replies)
Discussion started by: Ikebana
5 Replies

6. Shell Programming and Scripting

how to know the running processes.

Hi can anybody help me regarding this.. i want know the output of ps -ef with explanation. how can we know the running processess. this is the output of ps -elf F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 19 T root 0 0 0 0 SY ... (1 Reply)
Discussion started by: rajesh_pola
1 Replies

7. Solaris

Running processes on GZ/LZ

Hi guys just a question is it normal to see running process on a non-global zone in the global zone... processes such as cron. (3 Replies)
Discussion started by: batas
3 Replies

8. Linux

Running processes

Hi guys is it normal to have 5-10 cron/syslog processes running... in my case i got 10 cron process running. (4 Replies)
Discussion started by: batas
4 Replies

9. Solaris

Sendmail processes not running

Hi All! I am trying to get sendmail to work but unsuccessfull...when I run ps -ef | grep sendmail root 10578 10561 0 11:01:24 pts/1 0:00 grep sendmail I do not see its processes When I run the following commands: bash-3.00# svcs sendmail svcs: Pattern 'sendmail' doesn't match... (9 Replies)
Discussion started by: fretagi
9 Replies

10. UNIX for Beginners Questions & Answers

Many processes running at the same time

Hello everybody , I launched cron to execute a task every hour but the job takes more than hour that's why I'm getting more than 1000 cron processes running at the same time !!! My question is how to tell cron not to execute unless the job terminated in order to have only one process running .... (14 Replies)
Discussion started by: beautymind
14 Replies
RENICE(1)							   User Commands							 RENICE(1)

NAME
renice - alter priority of running processes SYNOPSIS
renice [-n] priority [-g|-p|-u] identifier... DESCRIPTION
renice alters the scheduling priority of one or more running processes. The first argument is the priority value to be used. The other arguments are interpreted as process IDs (by default), process group IDs, user IDs, or user names. renice'ing a process group causes all processes in the process group to have their scheduling priority altered. renice'ing a user causes all processes owned by the user to have their scheduling priority altered. OPTIONS
-n, --priority priority Specify the scheduling priority to be used for the process, process group, or user. Use of the option -n or --priority is optional, but when used it must be the first argument. -g, --pgrp Interpret the succeeding arguments as process group IDs. -p, --pid Interpret the succeeding arguments as process IDs (the default). -u, --user Interpret the succeeding arguments as usernames or UIDs. -V, --version Display version information and exit. -h, --help Display help text and exit. EXAMPLES
The following command would change the priority of the processes with PIDs 987 and 32, plus all processes owned by the users daemon and root: renice +1 987 -u daemon root -p 32 NOTES
Users other than the superuser may only alter the priority of processes they own. Furthermore, an unprivileged user can only increase the ``nice value'' (i.e., choose a lower priority) and such changes are irreversible unless (since Linux 2.6.12) the user has a suitable ``nice'' resource limit (see ulimit(1) and getrlimit(2)). The superuser may alter the priority of any process and set the priority to any value in the range -20 to 19. Useful priorities are: 19 (the affected processes will run only when nothing else in the system wants to), 0 (the ``base'' scheduling priority), anything negative (to make things go very fast). FILES
/etc/passwd to map user names to user IDs SEE ALSO
nice(1), getpriority(2), setpriority(2), credentials(7), sched(7) HISTORY
The renice command appeared in 4.0BSD. AVAILABILITY
The renice command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils /util-linux/>. util-linux July 2014 RENICE(1)
All times are GMT -4. The time now is 01:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy