Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Problem Controlling CM Agent Start / Stop in a Script

avatar
Expert Contributor

I tried to use a script which start / stop CM agent. It's found that if the agent was started and then stopped, the script will be killed. As show below:

 

 

[root@cdh52 ~]# cat myscript.sh
#!/bin/bash

service cloudera-scm-agent start
service cloudera-scm-agent stop
echo "Still Alive"


You have new mail in /var/spool/mail/root
[root@cdh52 ~]# ./myscript.sh
Starting cloudera-scm-agent:                               [  OK  ]
Stopping cloudera-scm-agent: Terminated

Note that [OK] and "Still Alive" is not displayed, because the parent script was killed when cloudera-scm-agent trying to stop the agent. The same effect if "service cloudera-scm-agent" was replaced by /etc/init.d/cloudera-scm-agent

 

What i don't understand is HOW kill find the parent processto kill. The cloudera-scm-agent script has already disown'ed the agent. And ps show that the PID of agent's parent is 1 (init), not myscript.sh. 

 

Any suggestion? 

1 ACCEPTED SOLUTION

avatar
Expert Contributor

Resolved by upgrade coreutils to 8.4-37.el6 (CentOS 6.5 original version: 8.4-31.el6)

View solution in original post

4 REPLIES 4

avatar
The supervisord log might have a clue. It is in
/var/log/cloudera-scm-agent/supervisord.log

Regards,
Gautam Gopalakrishnan

avatar
Expert Contributor

Thanks for the reply. It seems this is a general Linux issue when killing a "su" process (where agent is), not caused by CM.

 

Will update here when I get meaningful finding.

avatar
Expert Contributor

Resolved by upgrade coreutils to 8.4-37.el6 (CentOS 6.5 original version: 8.4-31.el6)

avatar
Thanks for the update!
Regards,
Gautam Gopalakrishnan