Pl identify EBS and OS versions, and why you need this terminate and startup functionality
Its 12.1.3 and we are getting the OPP hang up due to java memory error and we need to restart automatically as there are no alerts in AMP.
Pl post the java memory error stack, as well as any error messages from OPP log. You should be troubleshooting these, rather then trying to restart OPP from the command line. Has an SR been opened ?