I am using the following simple script in order to stop and start the ambari agent on linux machine rhel 7.6
more /tmp/script
#!/bin/bash
ambari-agent start
sleep 10
ambari-agent stop
echo "start stop ambari agent ended"
example
bash script
Verifying Python version compatibility...
Using python /usr/bin/python
Checking for previously running Ambari Agent...
/run/ambari-agent/ambari-agent.pid found with no process. Removing 25236...
Checking ambari-common dir...
Starting ambari-agent
Verifying ambari-agent process status...
Ambari Agent successfully started
Agent PID at: /run/ambari-agent/ambari-agent.pid
Agent out at: /var/log/ambari-agent/ambari-agent.out
Agent log at: /var/log/ambari-agent/ambari-agent.log
Verifying Python version compatibility...
Using python /usr/bin/python
Found ambari-agent PID: 25810
Stopping ambari-agent
Killed
as we can see from some unclear reason the script itself is killed when ambari-agent stop
performed
and therefore echo "stop start ambari agent ended"
, never implemented
any idea why this happens?
I have recently experienced quite a bit of weirdness in a recent RHEL7 ambari cluster role out. The weirdness was coming from higher level configurations in the operating system based on the default role out (azure). It's a long shut but maybe the bash execution is just too long and getting killed?