Salman reported,

I heard the Messenger of Allah ﷺ say, "Standing guard at the frontier for a day and a night is better than fasting and praying through an entire month. If he dies during it, the deeds he used to perform will continue to be credited to him, his provision will keep flowing to him, and he will be safe from the trial of the grave."

Azami 3880

Sahih

عن سلمان قال

سمعت رسول الله ﷺ يقول: رباط يوم وليلة خير من صيام شهر وقيامه، وإن مات جرى عليه عمله الذي كان يعمله، وأجرى عليه رزقه، وأمن الفتان.

الأعظمي 3880صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Conditions of the deceased in the grave
Section
Ribat in the cause of Allah is a protection from the punishment of the grave
Numbering
Jami al-Kamil 3880 (2nd edition)
Azami 3880