LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-20-2014, 05:30 PM   #1
5883
Member
 
Registered: Aug 2004
Posts: 173

Rep: Reputation: 0
Help: use monit to monitor a process doesn't work


Hi, sometimes my dhclient process could die without clue, don't know where the log file is.

so i want to use monit to restart dhclient.
This is what i added to /etc/monit/monitrc.
For testing, i'm called echo initially, when eth0's pid file is gone.

check process dhclient with pidfile /var/run/sendsigs.omit.d/network-manager.dhclient-eth0.pid
start program = "/bin/echo dhclient died, do something ..."


but nothing happened after 2 mins (i set in monitrc to check it every 2 mins)

Any suggestions ?
 
Old 05-21-2014, 09:01 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Something like this?

Code:
#!/bin/bash

if pgrep dhcpcd > /dev/null ; or pidof dhcpcd
then
    exit 0
else
    do something 
    exit 1
fi
#EOF
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script to start process doesn't work? shams Linux - General 4 08-18-2013 11:09 PM
Set umask in child process doesn't work sharky Programming 2 06-19-2008 07:34 PM
Please help: my LCD monitor doesn't work with Linux malb Linux - Hardware 1 07-30-2005 10:45 AM
INFO: configuring monit (process monitoring) markus1982 Linux - Software 0 05-25-2003 05:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:14 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