Seventeen people have been killed in two mass shootings that took place close to each other in a rural town in South Africa.