LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-23-2010, 03:40 PM   #1
qwerty0492
LQ Newbie
 
Registered: Sep 2010
Distribution: CentOS
Posts: 4

Rep: Reputation: 0
Perl Scripting: How to filter out kill to a client rather than daemon for sendmail


Hello,

I have an issue which I could use some advice on. Sometimes one of our servers has issues with sendmail and e-mails get "hung" and we have to kill them manually. In order to automate the whole process we are calling Proc:ProcessTables and then trying to kill a process that has been up for longer than one hour.

However.. the question is.. how do we tell the script to kill the perl client instead of killing off the daemon?

Code:
if (($p->fname eq "sendmail")&&($p->time > 3600000000)) {
    $logpid = $p->pid;
    #print "$logpid needs to be killed\n";
    system("echo \"killing sendmail $logpid  on `uname -n` at `date`\" | mail ourcompany\@ourcompany.com -s \"`uname -n`: killed sendmail\"");
    system(mail ourcompany@ourcompany.com -s \"`uname -n`: Long running sendmail process detected\""));
   $p->kill(1);
Any help would be greatly appreciated!
 
Old 10-11-2010, 03:24 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by qwerty0492 View Post
how do we tell the script to kill the perl client instead of killing off the daemon?
Daemons will have a PPID of 1 so any process that hasn't may be a child?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail ignores aliases with sendmail daemon stopped phavn Solaris / OpenSolaris 1 12-01-2008 02:50 PM
sendmail filter destination DJE007 Linux - Software 1 07-22-2008 08:11 PM
hello,all friend,about sendmail filter help me!! Pkuir.yangqun Linux - Software 3 07-05-2002 06:36 AM
hello,all friend,about sendmail filter help me!! Pkuir.yangqun Linux - Security 1 07-05-2002 05:34 AM
hello,all friend,about sendmail filter help me!! Pkuir.yangqun Programming 0 07-05-2002 12:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration