Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

How to install some of the dependencies prior to start the custom service(just one time)

avatar

Hello All, I am building a custom Service using CSD.  I want to install some of the dependencies prior to start the service(just one time) for. example installation of drivers, starting database servers etc. . I am doing that by calling a shell script prior to exec. But the problem is whenever there is a call to start to the service all the pre strart process run again. How can i achieve this.

 

#!/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
1 ACCEPTED SOLUTION

avatar
Create an initialization command and reference it in your SDL in serviceInit (see https://github.com/cloudera/cm_ext/wiki/Service-Descriptor-Language-Reference#serviceinit).

Move all of your one-time initialization logic to that command.

View solution in original post

2 REPLIES 2

avatar
Create an initialization command and reference it in your SDL in serviceInit (see https://github.com/cloudera/cm_ext/wiki/Service-Descriptor-Language-Reference#serviceinit).

Move all of your one-time initialization logic to that command.

avatar

Thanks for the reply. dlo.

It works.