I am running HPUX 11.11 (HPUX 11i) in a QEMU parisc virtual machine for a couple years now, as described here. It uses the classic rcX.d and init.d based approach for scripts to execute while starting up and shutting down.
# ls -l /sbin/init.d/rclocal
-r-xr-xr-x 1 bin bin 3297 Oct 14 18:13 /sbin/init.d/rclocal
The contents of this script, based off HP-provided example in /sbin/init.d/template, are:
Place symbolic links to the init script from the /sbin/rc3.d directory using the "ln -s" command so that there are two links pointing to the same target as below:
# ln -s /sbin/init.d/rclocal /sbin/rc3.d/K99rclocal
# ln -s /sbin/init.d/rclocal /sbin/rc3.d/S99rclocal
# ls -l /sbin/rc3.d/*rclocal*
lrwxrwxrwx 1 root sys 34 Oct 14 16:03 /sbin/rc3.d/K99rclocal -> /sbin/init.d/rclocal
lrwxrwxrwx 1 root sys 34 Oct 14 16:03 /sbin/rc3.d/S99rclocal -> /sbin/init.d/rclocal
Now we can create /etc/rc.local and /etc/rc.shutdown and put stuff to be executed during boot or shutdown respectively. It is important to remember these scripts are sourced by /sbin/init.d/rclocal, so we don't want to put in an exit statement in those scripts. Here are the minimal scripts I have currently.
# ls -l /etc/rc.local /etc/rc.shutdown
-rwxr-xr-x 1 root sys 173 Oct 14 15:38 /etc/rc.local
-rwxr-xr-x 1 root sys 220 Oct 14 15:42 /etc/rc.shutdown
/etc/rc.local
# This file is sourced from /sbin/init.d/rclocal
#PATH=/usr/sbin:/usr/bin:/sbin
#export PATH
date > /tmp/created-by-rc.local
sync;sync;sync
# DO NOT "exit"!
/etc/rc.shutdown
# This file is sourced from /sbin/init.d/rclocal
#PATH=/usr/sbin:/usr/bin:/sbin
#export PATH
date > /tmp/created-by-rc.shutdown
sync;sync;sync
# DO NOT "exit"!
That's it. Now /etc/rclocal should be executed during bootup and /etc/rc.shutdown during shutdown.