Being leery of executing "sudo rm /etc/rc*/*apache2" with the wildcard rc*,
instead I went to each /etc/rc?.d directory in turn (rc0.d through rc6.d) and
executed "sudo mv K09apache2 /dev/null" after which "find /etc/rc* -name
'*apache*'" produced no output. Then, being curious, I executed "find /*/*
-name '*apache*'" which I do not recommend that anyone do unless they have
the time to undo the result, which is a near infinite list of files, scripts,
"permission denied" and the like. It did reach a conclusion, after which I
closed the console. Preparing to come here to report my success in ridding
the system of apache, I found that the terminal could not be re-opened. Upon
executing a restart I was greeted with the biggest blinky screen of all,
detailing every aspect of my transgression. After the restart everything
works OK again.
However, the README file in each /etc/rc?.d directory provides a clue to the
mechanism by which a shutdown log could be created: "The scripts in this
directory are executed once when entering runlevel "?". The scripts are all
symbolic links whose targets are located in /etc/init.d/ . Generally it is
not necessary to alter the scripts in this directory. Their purpose is to
stop all services and to make the system ready for shutdown." I added the
wildcard "?" to signify "0" through "6". There is also a directory
/etc/rcS.d/ but that is for startup scripts, and it had no reference to
apache.
Poking around on the Internet, I found this page:
http://askubuntu.com/questions/416299/execute-command-before-shutdown-reboot
Where it says in part:
> To execute a script at shutdown or reboot:
>
> save your script in /etc/rc6.d
> Make it executable: sudo chmod +x K99_script
>
> Notes:
>
> The script in rc6.d must be with no .sh extension
> The name of your script must begin with K99 to run at the right time.
> The scripts in this directory are executed in alphabetical order.
This advice was in reference to the need to shut down forgotten VM's in an
orderly fashion. What I need to do will probably require that the script open
a file at the beginning of shutdown for input during the shutdown, meaning
that such script should be named with the prefix K01_script.
Now I just need to dream up that script ... with the caveat that saving the
input from freshclam to a log file has to be suppressed. I'll start here:
http://askubuntu.com/questions/471285/how-to-create-execute-a-script-file