Whirlpool refrigerator not cooling

My refrigerator stopped cooling. I removed the panel from the back and found the fan nor the compressor were working. THe light in the refrig however is on. I pulled the relay and shook it, which did not seem to have any loose parts that made noise. I also moved the thermostat from the 3 setting to off, then back on. Each time, I could hear the compressor come on, but it goes off within just a few minutes. Not sure what to do next…