Be cranky. Don't desperately try to snatch at some feeling you think you should have instead. Allow yourself to be cranky. Maybe you need an hour of being cranky. Maybe you need to kvetch to a friend for twenty minutes. Maybe you need a whole day. Whatever you need, take it. Don't try to wrench yourself into some state of being that you think is better or more appropriate or not so inconvenient. Be inconvenient. This is not to say that you should wallow. You know if you're prone to wallowing or if you're more inclined to soldier through. If you're a soldier, ready for action at a moment's notice and never offbeat: give yourself some space. Take an hour off from your life to feel, to take care of yourself, to do something that brings you joy. If you're a wallower, take some action: write an angry letter and rip it up, stomp around for awhile, take a walk. Search for the feeling below the cranky. Your crankiness is probably hiding something deeper. Maybe anger, maybe jealousy, maybe sadness. Allow that emotion to float to the surface and just feel it for awhile. If your emotions take you to a real place, take care of yourself once they're done whipping you around. Take a bath, take a walk, go see a movie. Do whatever you need to do to take care of yourself. Feelings can be hard work, but they're some of the best work you can ever do.
What to do when you're cranky? Be cranky. Until you aren't cranky any more. But recognize that crankiness is no greater or lesser state of being than any other. It simply is. When you can simply be with the cranky, you may find that it dissipates that much faster.