[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script to tell if Qpopper is running.



Account for Debian group mail wrote:
> Once in a while the Qpopper on our mail server will just die. I have
> to go in and issue a "/etc/init.d/openbsd-inetd restart" and it will
> be backup and running.

If 'openbsd-inetd restart' fixes it then the problem is that inetd has
died not qpopper, right?

[An opportunity to advocate using 'service' instead.  It cleans the
environment which prevents some userspace environment polution
problems from causing trouble.  It is just a good idea.]

  man service

  service openbsd-inetd restart

> Has anyone written a script that will run under a cron job that
> checks to make sure that the pop3 server is running and if not will
> restart it?

I know you already solved your problem.  But...  This is a very simple
brute force hack.

  $ service openbsd-inetd status
  inetd is running.

Therefore create a script that runs this check as often as you like.
When it turns up that it isn't running then restart it.  If this is
run by cron then the output of the restart will be mailed to root as
nofication of the action taken.

  #!/bin/sh
  if ! service openbsd-inetd status | grep -q 'is running'; then
    service openbsd-inetd restart
  fi
  exit 0

In the if statement there I would be inclined to dump out any
information I would need for debugging why inetd died.  I have never
seen that be a problem.  I have been using it for literally decades
and it is rock solid.  If it dies then I think something must be
actively killing it.  I would definitely try to debug what is
happening there.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: