Abu Musa Ashari reported,

The sun was eclipsed, so the Prophet ﷺ rose in alarm, fearing that the Hour had come. He went to the mosque and prayed with the longest standing, bowing, and prostration I had ever seen him perform. He said, "These signs that Allah sends do not occur for the death or life of anyone, but 'Allah uses them to instill fear in His servants'. So when you see anything of this kind, hasten to remember Him, supplicate to Him, and seek His forgiveness."

Bukhari 1059

Sahih

حدثنا محمد بن العلاء قال حدثنا أبو أسامة عن بريد بن عبد الله عن أبي بردة

عن أبي موسى قال

خسفت الشمس فقام النبي ﷺ فزعا يخشى أن تكون الساعة فأتى المسجد فصلى بأطول قيام وركوع وسجود رأيته قط يفعله وقال هذه الآيات التي يرسل الله لا تكون لموت أحد ولا لحياته ولكن {يخوف الله به عباده} فإذا رأيتم شيئا من ذلك فافزعوا إلى ذكره ودعائه واستغفاره

البخاري 1059صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Eclipse
Chapter
Remembrance during the eclipse
Numbering
Darussalam 1059
Bukhari 1059