Created on 05-06-2015 10:46 PM - edited 09-16-2022 02:28 AM
Hello All, I have build a custom service. I am doing some pre task (installation of drivers, start database and other daemon services etc) before calling exec.This service started succefully.
Duing stop from Cloudera Manager , along with the service started with exec I wanto stop the services started in pre task also.for that .I have written a script to stop all the daemon services
But I found that the only the service which is started with exec stops not in the pre-task.
Please Guide me , how to solve the isuue.
My service.sdl is as foolows
{ "name" : "MYAPP", "label" : "Myapp", "description" : "My App Custom CSD", "version" : "2.1", "runAs" : { "user" : "root", "group" : "root" }, "maxInstances" : 1, "icon" : "images/myapp.png", "parcel" : { "repoUrl" : "http://xx.xx.xx.xx:xxxx/latest/", "requiredTags" : [ "myapp" ] }, "roles" : [ { "name" : "MY_WEBSERVER", "label" : "My Web Server", "pluralLabel" : "My Web Server", "startRunner" : { "program" : "scripts/control.sh", "args" : [ "start" ] }, "stopRunner" : { "relevantRoleTypes" : ["MY_WEBSERVER"], "runner" : { "program" : "scripts/control.sh", "args" : ["stop"] }, "timeout" : 180000, "masterRole" : "MY_WEBSERVER" }, "topology" : { "minInstances" : "1", "maxInstances" : "1" }, "logging" : { "dir" : "/var/log/myapp-2.1/", "filename" : "myapp.log" } } ] }
and my control.sh is as follows-
#!/bin/bash CMD=$1 case $CMD in (start) echo "Starting the MyAPP Service" cp -r /opt/cloudera/parcels/myapp-2.1 /opt/ chmod 777 -R /opt/myapp-2.1/ sh /opt/myapp-2.1/resource/scripts/installer/MainScript exec python -m SimpleHTTPServer 8080 ;; (stop) sh /opt/myapp-2.1/resource/scripts/installer/StopAll ;; (restart) sh /opt/myapp-2.1/resource/scripts/installer/RestartAll ;; (*) echo "Don't understand [$CMD]" ;; esac
Created 05-08-2015 11:04 AM
Created 05-07-2015 06:01 PM
Created on 05-07-2015 10:53 PM - edited 07-08-2015 08:58 PM
Thanks for the reply. I am new to cloudera manager and CSD.
I tried by spliiting the process into roles.
In the role`s startrunner i have written to start one of my linux service, but the the role failed to start as Cloudera Manager attemped multiple times to start the same. First time it succeeded to start the service but then it attemped again multiple times and found the service is already running and thus failed to start. Please Guide me.
Following is the stdout
Fri May 8 01:26:13 EDT 2015 JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera Using /var/run/cloudera-scm-agent/process/887-xx-xx_SERVICE as conf dir Using scripts/control.sh as process script Starting the xx service xx Service StartsStarting xx-service service: xxservice started ... [ OK ] Fri May 8 01:26:16 EDT 2015 JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera Using /var/run/cloudera-scm-agent/process/887-xx-xx_SERVICE as conf dir Using scripts/control.sh as process script Starting the xx service xx Service Starts xx-service already running Fri May 8 01:26:18 EDT 2015 JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera Using /var/run/cloudera-scm-agent/process/887-xx-xx_SERVICE as conf dir Using scripts/control.sh as process script Starting the xx service xx Service Starts xx-service already running Fri May 8 01:26:21 EDT 2015 JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera Using /var/run/cloudera-scm-agent/process/887-xx-xx_SERVICE as conf dir Using scripts/control.sh as process script Starting the xx service xx Service Starts xx-service already running
Created 05-08-2015 11:04 AM
Created 05-08-2015 11:30 AM
Created 05-13-2015 03:56 AM
Thanks dlo,
You were correct, my service were daemons which was causing the issue.
I made them to run in forground and everything just works fine.