Endup file : executing automatically a piece of code ending Julia

Is there any mechanism like startup.jl to execute some code but instead at the beginning of julia REPL execute that code when closing the REPL. Indeed with the lack of support of history saving in IJulia, I want to automatically save all lines of my history in a file when closing my kernel. Is there anybody aware of such mechanism
Per advance, thanks

I only use the repl, but that automatically saves everything to ~/.julia/logs/repl_history.jl. Is there nothing like that for ijulia?

I was not aware of this file. I made a test and sadly IJulia does not save anything in this file. I use IJulia trough jupyter console to have vim shortcurts.

Seems there is a very old issue on the topic in the IJulia repo, implement saved history for consoles · Issue #47 · JuliaLang/IJulia.jl · GitHub

Maybe add a comment there to see if anyone wants to have a look at it.