I would like to execute two scripts, one is during start up and another one is during shutdown. I know we can add script in
/etc/rc.local which will be executed on start up, but if I want to execute something on shutdown, how can I do that?
Take a look at runlevels. With runlevel 0, you can execute scripts on shutdown. So you need to create your script somewhere, then create a symbolic link to it in
/etc/rc0.d. And be careful about permissions.
P.S : If you want to execute some scripts on reboot, it's runlevel 6.
I think what you are looking for can be found here: How to execute a shell script right b4 shuting down?