daemon in perl

K

kaustabh.banerjee

I have a perl daemon which queries the DB in every 10 secs and checks
some data. The daemon runs fine for most of the time, but dies
sometimes with some DB exceptions. I have put eval block to survive
this.

But still it breaks sometimes.

How to survive any exception at all. I just want to run no matter
what..
 
J

Josef Moellers

I have a perl daemon which queries the DB in every 10 secs and checks
some data. The daemon runs fine for most of the time, but dies
sometimes with some DB exceptions. I have put eval block to survive
this.

But still it breaks sometimes.

How to survive any exception at all. I just want to run no matter
what..

There's a mis-spelt identifier in line 1234 of your program.

1. How on earth are we to know what your problem is if you don't show us
any code?
2. Don't program around a problem, solve it.
 
T

Ted Zlatanov

On Thu, 25 Oct 2007 22:27:50 -0700 (e-mail address removed) wrote:

kb> I have a perl daemon which queries the DB in every 10 secs and checks
kb> some data. The daemon runs fine for most of the time, but dies
kb> sometimes with some DB exceptions. I have put eval block to survive
kb> this.

kb> But still it breaks sometimes.

kb> How to survive any exception at all. I just want to run no matter
kb> what..

(you should really find and fix your bug, as Josef Moellers suggested)

Use fork() to start a copy of your program, then *in the copy* do the
dangerous work. Use IPC if the parent process must know what the child
is doing. Make sure you wait for the child process. See `perldoc -f
fork' and all the related documentation for more information.

Ted
 
X

xhoster

I have a perl daemon which queries the DB in every 10 secs and checks
some data. The daemon runs fine for most of the time, but dies
sometimes with some DB exceptions. I have put eval block to survive
this.

But still it breaks sometimes.

Have you considered scotch tape? Or at least telling us what errors you
are getting?
How to survive any exception at all. I just want to run no matter
what..

If the database server is on fire, exactly what is the client supposed to
do? If you want your program to "run" no matter what, even if it doesn't
do anything useful, then replace all the code with "sleep while 1"

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top