Daemon - Automatically restarting

This is a discussion on Daemon - Automatically restarting within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I have a C program which links an oracle DB to IBMs MQ series. This program should run all ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1

    Daemon - Automatically restarting

    Hi,

    I have a C program which links an oracle DB to IBMs MQ series. This program should run all the time polling the database, taking data from the database tables, constructing a message from this data and putting this message onto the MQ queue.

    My problem is that when the database is shutdown at night the program sometimes shutsdown as well because it can't log off of the database. I then have to manually restart it in the morning which can mean up to a 9 hour delay in messages being dealt with.

    I would like the program to either run continuosly or to restart automatically?

    Being a complete beginner at C programming (i.e. program was written by consultants and we have to support it) I have no idea how to resolve this.
    Can anybody tell me the best solution to this problem?


    Thanks in advance.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    >when the database is shutdown at night

    Your database is shutdown at night ? Wow. Who is doing that ?
    Can't he just end the program before shutting the DB down ?
    Likewise in the morning... if you startup your DB each morning,
    the same person or job should start up your program.

    >the program sometimes shutsdown as well

    The easiest way ( besides not shutting down the database... )
    would be making the program more error resistant. If it
    encounters a DB error, don't shut down, but wait and try again.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    A crude but effective way of making sure your process is running is make a watchdog task. This is a process whose only joy in life is to periodically check if another task is active, and if not, activate it. This protects against all kinds of things, accidental closure, unexpected exceptions, cosmic ray strikes etc. It is an approach I use often on remote, largely unattended computers.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Daemon process debugger
    By karthigayan in forum C Programming
    Replies: 2
    Last Post: 03-31-2009, 12:28 AM
  2. daemon problem please help
    By fairyjerry14 in forum C Programming
    Replies: 2
    Last Post: 09-07-2007, 02:43 AM
  3. Daemon problem
    By gandalf_bar in forum Linux Programming
    Replies: 3
    Last Post: 07-20-2004, 06:23 AM
  4. Help using unix socket for daemon
    By Tal0n in forum Linux Programming
    Replies: 1
    Last Post: 01-13-2004, 11:10 AM
  5. Daemon Programming
    By gnu-ehacks in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 11-24-2001, 03:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21