I've got into a scenario in which I want to stop a currently executing java process in custom Azure VM. The VM is a ubuntu machine which is configured by our Infra.
I'm building a Azure - Continuous Deployment pipeline in which I want to deploy the latest build in the VM. But before I could deploy the latest build, I need to bring down the currently executing Java Process of previous build.
I was using "Command Over SSH" to trigger a 'kill' signal with the process ID of the java process, but Azure forbids use of 'kill' command in a pipeline.
Logs
==============================================================================
Task : SSH
Description : Run shell commands or a script on a remote machine using SSH
Version : 0.165.1
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/ssh
==============================================================================
Trying to establish an SSH connection to ***@<HOST>:22
Successfully connected.
chmod +x "./sshscript_158452036****"
"./sshscript_158452036****"
========** Stop currently executing process: 4381
##[error]./sshscript_158452036****: line 5: kill: (4381) - Operation not permitted
Is there any other way to gracefully bring down the Java Process. OR Achieve the CD with some other solution. I'm not planning to Dockerize the deployment.
Thanks !