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 follows
{
"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://54.12.197.150:8111/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