Shutting down Solaris

Hi
I have a mix of solaris 8,9 & 10. I need to have our 6 Solaris servers shutdown buy a script that will be executed by APC network Shutdown software

Im really not sure how I would write a script to shut them down and the following processes?

the processes are

portmapper
seq
seq_api
seq_cbot
seq_cds
seq_liffef
seq_storage.

the script must be help locally on the server and I need the script to shutdown the server completely off regardless of if the services are on or off.
basically if the processes are on the script shuts them down, including the server
if the processes are not on, the script sees the processes are not and shuts the server down

Probably all you need is :
init 5