When David’s time to die drew near, he commanded Solomon his son, saying, “I am about to go the way of all the earth. Be strong, and show yourself a man, and keep the charge of the LORD your God, walking in his ways and keeping his statutes, his commandments, his rules, and his testimonies, as it is written in the Law of Moses, that you may prosper in all that you do and wherever you turn, that the LORD may establish his word that he spoke concerning me, saying, ‘If your sons pay close attention to their way, to walk before me in faithfulness with all their heart and with all their soul, you shall not lack a man on the throne of Israel.’
“Moreover, you also know what Joab the son of Zeruiah did to me, how he dealt with the two commanders of the armies of Israel, Abner the son of Ner, and Amasa the son of Jether, whom he killed, avenging in time of peace for blood that had been shed in war, and putting the blood of war on the belt around his waist and on the sandals on his feet. Act therefore according to your wisdom, but do not let his gray head go down to Sheol in peace. But deal loyally with the sons of Barzillai the Gileadite, and let them be among those who eat at your table, for with such loyalty they met me when I fled from Absalom your brother. And there is also with you Shimei the son of Gera, the Benjaminite from Bahurim, who cursed me with a grievous curse on the day when I went to Mahanaim. But when he came down to meet me at the Jordan, I swore to him by the LORD, saying, ‘I will not put you to death with the sword.’ Now therefore do not hold him guiltless, for you are a wise man. You will know what you ought to do to him, and you shall bring his gray head down with blood to Sheol.”
Then David slept with his fathers and was buried in the city of David. And the time that David reigned over Israel was forty years. He reigned seven years in Hebron and thirty-three years in Jerusalem.