Hi Cindy,
There isn't a server feature to run JavaScript on mongod startup.
One suggestion would be to write a bash shell wrapper to start/restart the mongod service and run your JavaScript code afterward.
Alternatively you could write an app which periodically pings the server and checks the uptime to infer a restart since the last check (eg. value of "db.serverStatus().uptime" in the shell).
What sort of value do you need to check?