Gmc air condition

In the past 6 months my a/c, which seems to work fine, will start blowing hot air and will not stop unless I shut everything down. Once I crank up the engine again, the a/c is back to blowing cold air again- - -the thing is I have to shut everying off to get it working again- - -this has only happened 5 or six times in the last 6 months- - -seems like shutting down the engine resets things again. – -it has 52K miles on it. Thanks for any info- - John