help with timing

So I am an arduino newb trying to get this program setup. Basically it controls a relay which creates rain in my chameleon enclosure. Here is the code I have that seems to work:

int relayPin = 7;
int button1 = 4;
int button2 = 3;
int rainduration = 30000;

unsigned long interval = 7200000; // the time between rain
unsigned long previousMillis = 0; // millis() returns an unsigned long.

void rain(){//defines rain
digitalWrite(relayPin, HIGH);
delay (rainduration);
digitalWrite(relayPin, LOW);//rain will turn on the relay for rainduration/60 sec
}

void setup() {
pinMode(relayPin, OUTPUT);
pinMode(button1, INPUT);
pinMode(button2, INPUT);

rain();//rain once on startup

}
void loop() {

if ((millis() - previousMillis) >= interval) {
previousMillis = millis();
rain(); //if 3 hours have elapsed, run rain and update previous millis
}
/*
if(digitalRead(button2)== HIGH) //reads button 2
{
digitalWrite(relayPin, HIGH); //turns rain on for 30 sec
delay(30000);
digitalWrite(relayPin, LOW);

}
*/

delay (10);

}

So relaypin is the pin that controls the relay/water pump. I have the arduino hooked into the timer that controls the lights in the terrarium, so the arduino turns off at night and on every morning. rainduration is how long I want it to rain for and interval is how often it rains. I currently have it set for 30 seconds of rain every two hours. Now for some reason when I set rainduration for 45000 it goes past 45 sec and won't stop raining. I also tested a shorter interval of 5601000 and had no luck when 300000 worked fine. I also had some button functions I was working on but commented them out in order to trouble shoot. Any advise or ideas as to why I'm having issues? Thanks.

You are using an int for rainduration. It can't hold a value greater than 32767. Your 45000 gets truncated to 16 bits and becomes a negative number. When that 16-bit negative number is expanded to a 32-bit value so it can be compared to a time value it gets sign-extended which gives you an unsigned long value near 4.2 Billion (47 days?).

ALWAYS use 'unsigned long' for values associated with millis() and micros().

AAAHH, Thanks a bunch!