In general the Generator goes through a start up procedure which test whether their is sufficient oil and whether the generator is producing electricity - if either fails then the Generator shuts off.
You can rule out the oil sensor by bridging the contacts - if the generator runs fine after doing that replace the sensor. If it's not the sensor then it gets more complicated - might be brushes, regulator, circuit board etc.
The service manual on your generator s/b available on-line - it should outline how to test each of the possible causes for your problem. You might find a PDF for free or you can order one.
Kevin