Does ANYONE know how to turn off the GSM in a loop?

It seems no one has mastered the GSM shield, or how to turn it off. I need to turn this thing off desperately to save battery but never got a response. I tried just calling high and low to the power pin on the gsm, it just resets it. I tried the GSM.H library, which has a gsm.shutdown(); function, but that too just resets it, unless there's a long delay.

Here's the code I am playing with to turn on, then off the gsm.

#include <GSM.h>

GSM gsm;
GSM gsmAccess;
GSM_SMS sms;
void setup() {
 Serial.begin(9600);
  // put your setup code here, to run once:

}

void loop() {
gsm.begin();
Serial.println("on");
delay(1000);
gsm.shutdown();
Serial.print("gsm off, long delay");
delay(100000);
   

}

It's really frustrating.

What I need: to have an else statement that says

else {
condition
gsm.shutdown();

and have the GSM modem shut down without having to run the delay. It would loop over the condition and shutdown, which is the problem. Since it keeps looping over shutdown, it keeps turning the GSM modem back on and off. Super annoying. Any ideas?????? Been blocked for weeks trying to get around this, have yet to find anything solid.

Is there a way to keep calling gsm.shutdown(); and not have it reset?

"Description

Disconnects from the GSM network identified on the SIM card by powering the modem off.

Syntax

gsm.shutdown()

Parameters

none

Returns

boolean : 0 while executing, 1 when successful"

I have the arduino uno + arduino gsm shield

figured it out. Need to set a boolean to check if it = true so it doesn't keep executing.