Possible meanings are 1) "killed those men during a time of peace as if he were killing them in war" or 2) "took revenge on those men during a time of peace because they had killed people in war" (See: [[rc://en/ta/man/translate/figs-metonymy]])
Possible meanings are 1) Joab was close enough to these men when he killed them that their blood spattered on his belt and on his sandals or 2) the word "blood" is a metonym for guilt of murder, and the belt and the shoes are metonyms for Joab's authority as commander, so David is saying that because Joab is guilty of murder, he should not be commander of the army. Either way, it is best to translate this literally. (See: [[rc://en/ta/man/translate/figs-metonymy]])
Here being old is represented by having gray hair, that is, a "gray head." AT: "make sure Joab dies a violent death before he grows old" (See: [[rc://en/ta/man/translate/figs-metonymy]])