The startup or shutdown handler should do this. They are not sent in the Rev developement. Only Standalone. When working on a project in developement I just have to type startup or shutdown in message box to see if everything is OK.