Your supervisors refusal to say hi in response to your greeting can be due to something as simple as not hearing you. Some people do get distracted and actually tune out the rest of the world. But given that he has other behaviors that indicate he has issues getting along with others, most likely the greeting issue is due to his insecurity issues.
Someone who make a point of ignoring others, talks about others behind their backs and puts them down, and talks about you as you pass by is insecure. That basically means that they never developed a good self esteem, maybe because they were put down as a child or they were abused in some manner. Because they do not feel good about themselves, they try to put others down so they can feel more superior. But since this is only makes them feel better temporarily, they have to keep doing it to get the same effect. And if you show no reaction, they may try even harder. That is because by ignoring them, they feel even less adequate so they try harder to make up for it.
Your supervisor likes to be unpredictable probably because it makes him feel more in control. This is important to someone who has a low self esteem and adequacy issues. They need to have control so they feel better. Being unpredictable keeps you guessing, so they can make you feel inadequate. What you may want to try in response to this is either to not say hello at all, or to say it whether or not he responds or says it first. If you are consistent, then he has no way to control you. He may still try, but it takes the power out of what he is doing.
You are right, talking about him or anyone else only makes you look just as bad as he does. People may seem to enjoy hearing what you say, but in the end, they only wonder if you can be trusted or if you talk about them like that. And it has no effect on your night supervisor as he only feels worse when he hears about you talking about him. It will make him target you so he can deal with his feelings of inadequacy by bringing you back down again. It can become a cycle that goes out of control and ends up with one of you, or both or you, losing your job.
There are many techniques that can help you cope with your night supervisor's behavior. Mindfulness can be one, but learning how to relax and reduce your anxiety and reaction to the behavior is another. Here are some resources I recommend:
http://www.guidetopsychology.com/pmr.htm- This is a great guide to how to relax. The more you practice it the easier it gets. And it can be used anywhere.
Guided Imagery for Self-Healing by Martin L. Rossman
Just to let you know, I will be away from my computer from this Sunday May 13th to Wednesday May 16th. I will try to check in, but I'm not sure I'll have access to internet (out of town trip). I didn't want you to write and not be able to get a quick answer.
Let me know if you need more resources or have any more questions. I enjoy talking with you!