after few hour program is not run and need to reset

I have a project to design Generator Auto Start when mains fail(signal from ATS) and switched off generator when mains back.

following code work properly. but program is not run and need to reset(press reset button) after few hours. But still code work as it is when reset.

please help me to solve this case and i have mentioned my code below.

//////////////////////////////////////////// automatic backup generator starter using Arduino /////////////////////////////////////////////////////
int buttonState = 0; // to detect ATS signal input interrupt
int buttonState2 = 0; // to detect Alternator input
const int btn=2; // pin number of the ATS signal input interrupt
const int btn2=4; // pin number of the Alternator input
int GenHeterRly=A5; // relay for gen heater signal
const int GenStopRly = 8; // relay for gen stop signal
int GenStartRly = 10; // relay for gen starting(crank) signal
int ledgenrun=12; // for gen run indication
const int led =5;
///////////////////////
long debouncing_time = 15; // Denouncing Time in Milliseconds
volatile unsigned long last_micros;
///////////////////////
void setup()
{
//////////// intitialize pinmode////////////////
pinMode(4, INPUT); // Alternator input
pinMode(A5, OUTPUT); // gen heater signal
pinMode(8, OUTPUT); // gen stop signal
pinMode(10, OUTPUT); // gen starting(crank) signal
pinMode(12, OUTPUT); // gen run indication
pinMode(13, OUTPUT); // Pin 13 is a output which LED is connected to identify gen starting(crank)
pinMode(5, OUTPUT);
/////////////////////initialize pin states//////////////////
digitalWrite(13, LOW); // Make pin 13 low, switch LED off
digitalWrite(10, LOW); // Make pin 10 low, switch off relay for gen starting signal
digitalWrite(A5, LOW); // Make pin A5 low, switch off relay for gen heart signal
/////////initialize interrupts//////////////////
pinMode(2, INPUT); // Pin 2 is the interrupt input
attachInterrupt(0, debounceInterrupt, RISING); // initialize debounceInterrupt (on pin 2 for RISING) to GenOn
}
///////////////////////////////////////////////////////////////
void loop() {
buttonState = digitalRead(btn);
if (buttonState == HIGH) { // check for ATS signal enable or not
digitalWrite(5, HIGH);
}
else {
digitalWrite(5, LOW);
}
}
///////////////////////////////////////////////////////////////////////
void debounceInterrupt() { // calling debounceInterrupt (on pin 2 for RISING) to GenOn
if((long)(micros() - last_micros) >= debouncing_time * 1000) {
Interrupt();
last_micros = micros();
}
}
void Interrupt() {
//////////////gen heat relay function//////////
digitalWrite(8, LOW); // gen stop relay off
digitalWrite(A5, HIGH); // for ON heater relay
delay(60000);
digitalWrite(A5, LOW); // for OFF heater relay
delay(80000);
digitalWrite(A5, LOW);
///////////gen start(1) relay function//////////
digitalWrite(8, LOW); // gen stop relay off
digitalWrite(13, HIGH); // indication for gen starting(1) relay signal ON
digitalWrite(10, HIGH); // gen starting(1) relay signal ON
delay(60000);
digitalWrite(13, LOW); // indication for gen starting(1) relay signal OFF
digitalWrite(10, LOW); // gen starting(1) relay signal OFF
///////////////////////////////////////
blink2(); // function for 2nd time gen staring(crank) if not start in 1st attempt
//////////////////////////////////////
detachInterrupt(0); // disable debounceInterrupt of GenOn
attachInterrupt(0, GenOffInterrupt, FALLING); // initialize GenOffInterrupt (on pin 2 for FALLING) to GenOff
//////////////////////////////////////
}
////////////gen start(2) relay function/////////////
void blink2() {
delay(60000);
buttonState = digitalRead(btn); // to detect ATS signal input interrupt
buttonState2 = digitalRead(btn2); // to detect Altrntor input
if ( buttonState2 == LOW && buttonState == HIGH) // if ATS signal On and Altenator signal OFF
{
delay(200000); // delay before 2nd gen start signal
digitalWrite(8, LOW); // gen stop relay off
digitalWrite(13, HIGH); // indication for gen starting(2) relay signal ON
digitalWrite(10, HIGH); // gen starting(2) relay signal ON
delay(60000);
digitalWrite(13, LOW); // indication for gen starting(2) relay signal OFF
digitalWrite(10, LOW); // gen starting(2) relay signal OFF
}
else { // If ATS signal On and Alternator signal ON or If ATS signal OFF and Altenator signal OFF
digitalWrite(13, LOW); // indication for gen starting(2) relay signal OFF
digitalWrite(10, LOW); // gen starting(2) relay signal OFF
}
}
///////////////////////////////////////////////////////////
void GenOffInterrupt() { // calling GenOffInterrupt (on pin 2 for FALLING) to GenOff
if((long)(micros() - last_micros) >= debouncing_time * 1000) {
Interrupt1();
last_micros = micros();
}
}
void Interrupt1() {
digitalWrite(8, HIGH); // gen stop relay on
delay(100000);
digitalWrite(8, LOW); // gen stop relay off
detachInterrupt(0); // disable GenOffInterrupt of GenOff
attachInterrupt(0, debounceInterrupt, RISING); // again initialize debounceInterrupt (on pin 2 for RISING) to GenOn
}

delay() does NOT work in an interrupt service routine.

Was there some part of "interrupt service routines must be fast" that you thought didn't apply to you? You were wrong.

can you please do any suggestion :neutral_face: for this

can you please do any suggestion :neutral_face: for this

Quit using interrupts.

Polling the pin on every pass through loop() should be plenty often enough to detect that the power has gone off. Really, is it necessary to start the generator within nanoseconds after the power goes off?

If you insist on using interrupts the code should be very short - just to record the fact that it happened. For example

void GenOffInterrupt() {
   genOff = true;
}

and the code in the main part of your program should then deal with the variable genOff.

But as @PaulS has said, it is hard to see any reason to use interrupts.

...R