refrigerator/freezer doesn't get cold

refrigerator/freezer doesn’t get cold. I tried to unplug it and waited for about 15 minutes then plugged it in again. I heard the compressor and fans start running. After about 5 seconds There was a loud click and the compressor quit running. The fans contunued to run. There is a box with 2 wire gong into it on the side of the compressor, it felt pretty warm. Any ideas on how to fix it or should I just replace with a new frig?