The police prosecutors told the court the man, who can not be named to protect the victim, was driving in Madora Bay on November 8 last year.
The accused saw his ex-partner in his brother’s car with his two sons and began following them.
When the couple parked at the nearby Coles, the accused took a metal baseball bat out of his car and spoke to his ex.
Get in front of tomorrow's news for FREE
Journalism for the curious Australian across politics, business, culture and opinion.
READ NOWThe victim was leaving Coles when the accused approached him with the baseball bat and hit him on the back of the knee.
Counsel for the accused told the court the man was recovering in hospital from an accident which nearly killed him when his partner left him for his brother.
The accused claimed they were preventing him from seeing his sons.
Magistrate Anne Longden described the situation as unusual, unbearable and difficult.
But she reminded the man that there were other ways to manage frustration.
She sentenced him to a nine-month community based order with program requirements.