Skip to content

Instantly share code, notes, and snippets.

@waffle2k
Created May 13, 2014 18:29
Show Gist options
  • Save waffle2k/b036110d743e6efbc229 to your computer and use it in GitHub Desktop.
Save waffle2k/b036110d743e6efbc229 to your computer and use it in GitHub Desktop.
run via "watch watch-ps.pl" to view the process tree of the cron jobs running on a machine...
#!/usr/bin/perl -w
use strict;
my $search = shift || 'CRON';
my $following = 0;
for (`ps auxwwf`){
chomp;
$following++ if /$search/;
if ( /\_/ ){
print "$_\n" if $following;
}
else {
$following=0 unless /$search/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment