He joined the
Royal Navy in the 1770s and served off the Eastern Seaboard of North America during the
American War of Independence, seeing action at the
Siege of Charleston. He was subsequently transferred to
Newfoundland and, as a lieutenant, given command of the sloop
HMS Morning Star for the remainder of the war. During the peace of 1783 to 1793, Donnelly joined the fleet of the
Honourable East India Company, serving as a mate before rejoining the Navy at the outbreak of the
French Revolutionary Wars. Donnelly later took command of
HMS Maidstone and in 1801 escorted a convoy from
Porto to Britain before taking command of the frigate
HMS Narcissus and charged with returning the ambassador to Algeria before carrying out astronomical observations in the Aegean Sea. From there he joined the
Mediterranean Fleet where Admiral
Lord Nelson would later hold him in high esteem, commending him in letters and placing several of his proteges under Donnelly's command. In 1805, he accompanied the expeditionary force which invaded the Cape of Good Hope and the
Rio de la Plata, where he was commended and rewarded on his return to Britain with command of the ship of the line
HMS Ardent which he brought back to South America and continued serving in the campaign until its conclusion in 1807. In 1808, he took command of
HMS Invincible, but was forced into early retirement in 1810 due to
cataracts. His eyesight slowly recovered over the next two years, and at the end of the war he was on the verge of commissioning the new ship of the line
HMS Devonshire. ==Retirement and health==