Super “strace” perl script to assist with debugging programs that spawn child processes.

If you have ever ran into a problem with trying to strace apache or other processes that spawn children, then this script will help you out greatly. This small perl script will grab all of the PID’s of the current process and its children and then run an strace command on all of them to provide strace output from all of apache. You can modify the strace line to your liking as well as the log names, by default it logs to a file based on date and time to the /tmp directory. Code included, click ‘Read More’.

If you have ever ran into a problem with trying to strace apache or other processes that spawn children, then this script will help you out greatly. This small perl script will grab all of the PID’s of the current process and its children and then run an strace command on all of them to provide strace output from all of apache. You can modify the strace line to your liking as well as the log names, by default it logs to a file based on date and time to the /tmp directory. Code included, click ‘Read More’.


#!/usr/bin/perl

# Do we have any input?
if(!$ARGV[0]) {
print "Super strace, will strace a running application and all of its children.\nUsage: $0 \nExample: $0 apache2\n";
exit;
}
# get the data we need!
@pids = `pgrep @ARGV[0]`;
# this is the old method, if pidof doesn't exist uncomment if the above breaks
#@pids = `ps auxwwf | grep apache | awk \'\{ print \$2\}\'`;
# get some variables for the current time! Gotta be iso 8601 YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
#my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime time;
$date = `date +%FT%H:%M:%S%:z`;
chomp ($date);
#$year += 1900;
#$mon += 1;
#$date = "$year-$mon-$mdayT$hour:$min:$sec";
# the strace command! this can be replaced with any command
$go="strace -f -s 40000 -o /tmp/sstrace-$date";
# the separator
$sep = " -p ";
$i=0;
foreach $pid (@pids) {
chomp ($pid);
$go = $go . $sep . $pid;
$i++;
}
print $go . "\n";
exec $go;

0 Shares:
You May Also Like

Auckland Security Consultant uses PS3 for Cryptography

As the title states, a Senior Security Consultant by the name of Nick Breese is using a PS3 to crack MD5 hashes. Aside from this article incorrectly stating that the security expert is stealing passwords, as of now he has only shown how fast the machines can process MD5 hashes. This is just a small glimpse of what the software and hardware can do, the article compares how many cycles can be completed using Vector Computing:

BlockHosts 2.0.5 (Default branch)

BlockHosts 2.0.5 (Default branch) - BlockHosts is a script to record how many times a local system is attacked, based on configurable scanning of system logs for sshd or other services. When a particular IP address exceeds a configured number of failed login attempts, that IP address is blocked using hosts.allow files, or by using null-routing, or by using packet filtering. An email notification facility is also available. License: Public Domain Changes:
This release updates the vsftpd rule and adds an --enable-patterns option to enable specific rules at run-time. Email notification is now sent on both adds and deletes of host IP addresses, and the source distribution includes the test routines.

[FreshMeat]

Setting up daily, weekly and monthly MySQL Database Backups using AutoMySQLBackup

AutoMySQLBackup is a shell script that allows daily, weekly and monthly backups of your local and remote MySQL Databases. It's meant to run on Linux/Unix through a cron job. Its highly configurable, and easy to setup as I will show you today! First you will need to acquire the shell script and drop it on your server. You can download AutoMySQLBackup on their SourceForge Project Page

Powerful MediaWiki Plugin allows you to display articles based on specific criteria.

If you run MediaWiki software, then you really need to check this plugin out. This paticular plugin allows you to pick specific criteria, the below example shows some of the parameters you can pass: category=+Africa|Europe category=Politics and conflicts ordermethod=category,sortkey headingmode=ordered You can setup a list of last modified articles, top articles, newly created article. For full documentation on what parameters are available you can view the DPL Manual at <a href="http://semeb.com/dpldemo/index.php?title=DPL:Manual"http://semeb.com/dpldemo/index.php?title=DPL:Manual The official link on MediaWiki's extension page: http://www.mediawiki.org/wiki/Extension:DynamicPageList