Here is something that I wrote to identify whether a process has been idle for over 30 mins.
Assumptions. The process is attached to a tty.
There are some processes which might be over 30 mins, and are idle. But you need to take precaution when using this script. Some of them might be very useful even though they are/have been idle for days.
does anyone know an easy way that at the beginning of your script you check to see if that process is already running? I think it would have something to do with ps but I may be making it more complicated than it has to be. If you have a script run say, every half hour, you would want to check and... (13 Replies)
Hi,
Is there any way in Unix to check for the system usage processwise ??
I mean I wud like to get a listing of running processes along with their CPU / memory utilisation so that I can spot dangerous the space / memory eaters ..
Thanks & regards,
SNS (2 Replies)
I want to find the pid ( by ps ) that has already run over 30 seconds , I know ps only show the minute/hour .
eg. the start time of the below process are 15:19 / 15:20 , but I don't know the exact time ( in term of "second" ) it start to run ( I only know the hour and minute ) , if I want to... (2 Replies)
Except the command "top" , is there other function / tool is used to check the process status in the system like
1. what process are running ?
2. how the CPU are allocating ?
3. how many swap is using ?
4. "
Thx. (1 Reply)
Hi Everybody
I have small requirement that needs to be implemented in shell script.
Currently i have shell script which invokes a java process say "Process A" which runs in background.
If some one tries to invoke again the same shell script , then there should be some mechanism inside the... (23 Replies)
How to find what are the cron jobs which are running at any instant on a Solaris server ??? The job can be scheduled from any id but still would like to list all the cron jobs which are running on the server ??? (2 Replies)
Hi..
I have this code which tells me that if a process is running or not. Actually someone on this forum help me to do it. :) But now If i want to check if the process is not running for more than 10 minutes. Does anyone know the code or syntax that checks if a process is not running for some... (1 Reply)
Hi ,
I have a csh code below which check the process if it's running.
Can any expert advise me on the following:
1) what does this notationmean ">!" and how is it different from the append ">" notation ?
2) how does "setenv" work in this code ?
# Check whether there is a running... (3 Replies)
Hi
I would like to check if an instance of a script is already running.
I've seen many different examples, but I haven't the slightest idea as to how to do this.
Can you please help.
Thank you. (5 Replies)
I have process1 running on one machine and generating some log file. Now another process which can be launched on any machine wants to know if process1 is running or not and also in case it is running it wants to stream the logs file generated by process1 on terminal from which process2 is... (2 Replies)
Discussion started by: saurabhnsit2001
2 Replies
LEARN ABOUT DEBIAN
anyevent::aggressiveidle
AnyEvent::AggressiveIdle(3pm) User Contributed Perl Documentation AnyEvent::AggressiveIdle(3pm)NAME
AnyEvent::AggressiveIdle - Aggressive idle processes for AnyEvent.
SYNOPSIS
use AnyEvent::AggressiveIdle qw(aggressive_idle};
aggressive_idle {
... do something important
};
my $idle;
$idle = aggressive_idle {
... do something important
if (FINISH) {
undef $idle; # do not call the sub anymore
}
};
DESCRIPTION
Sometimes You need to do something that takes much time but can be split into elementary phases. If You use AE::idle and Your program is a
highload project, idle process can be delayed for much time (second, hour, day, etc). aggressive_idle will be called for each AnyEvent loop
cycle. So You can be sure that Your idle process will continue.
EXPORTS
aggressive_idle
Register Your function as aggressive idle watcher. If it is called in VOID context, the watcher wont be deinstalled. Be carrefully.
In NON_VOID context the function returns a guard. Hold the guard until You want to cancel idle process.
stop_aggressive_idle
You can use the function to stop idle process. The function receives idle process PID that can be received in idle callback (the first
argument).
Example:
use AnyEvent::AggressiveIdle ':all'; # or:
use AnyEvent::AggressiveIdle qw(aggressive_idle stop_aggressive_idle);
aggressive_idle {
my ($pid) = @_;
....
stop_aggressive_idle $pid;
}
The function will throw an exception if invalid PID is received.
Continuous process.
Sometimes You need to to something continuous inside idle callback. If You want to stop idle calls until You have done Your work, You can
hold guard inside Your process:
aggressive_idle {
my ($pid, $guard) = @_;
my $timer;
$timer = AE::timer 0.5, 0 => sub {
undef $timer;
undef $guard; # POINT 1
}
}
Until 'POINT 1' aggressive_idle won't call its callback. Feel free to stop_aggressive_idle before free the guard.
AUTHOR
Dmitry E. Oboukhov, <unera@debian.org>
COPYRIGHT AND LICENSE
Copyright (C) 2011 by Dmitry E. Oboukhov
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or,
at your option, any later version of Perl 5 you may have available.
VCS
The project is placed on my GIT repo: <http://git.uvw.ru/?p=anyevent-aggressiveidle;a=summary>
perl v5.10.1 2011-03-01 AnyEvent::AggressiveIdle(3pm)