We are developing an application that must be launched on startup immediately after the DHCP server has been initialised successfully. We explored the Utopia subcomponent of RDK-B and found that the DHCP server is run through the service_dhcp_server.sh script and not systemd. We were also successful in registering and launching a dummy service (/etc/utopia/registration.d/30_test_service + /etc/utopia/service.d/test_service.sh). 

Questions:

  1. How do we register a service to run as soon as the DHCP server is initialized successfully? Is it possible to do so without Utopia?
  2. How do we ensure that our service is autostarted? Does the number prefixing the name of the registration executable (e.g., 15_dhcp_server) have any impact? If yes, is there a standard that defines the number to be chosen?

30_test_server.ctest_server.sh

  • No labels

4 Comments

  1. HI Nithin patet,

    yes we can register our own service to run as soon as the particular service is initialized by using sysevents.
    Sysevent utility will activate respective handlers upon events.

    syntax:
    sysevent async event_name $HANDLER

    example:
    sysevent async new_event_name /etc/utopia/service.d/new_service_handler.sh

    sysevent async ethwan-initialized /etc/utopia/service.d/service_crond.sh


    Note:
    1. Register for $HANDLER to be activated whenever <event_name> changes value. Ensure that if multiple value changes occur, then only one instance of $HANDLER will be run at a time.
    sysevent async event_name $HANDLER

    2. Register for $HANDLER to be activated whenever any value is SET for <event_name>
    sysevent async event_name $HANDLER
    sysevent setoptions event_name $TUPLE_FLAG_EVENT



    The files with numbers(15_dhcp_server) is used because there is a execute_dir programs will execute all files in the sysevent registration directory  /etc/utopia/registration.d in lexicographic order. This is useful as the shell scripts should be called in certain order .


    Thanks and Regards

    Srinivas

    1. Hi Srinivas,


      Thanks for the suggestion!

      sysevent async event_name $HANDLER would need to be executed on every reboot, right? If our service must be started as soon as DHCP server is up, is it better to use an executable in /etc/utopia/registration.d/?

  2. HI Nitin Patet, 

    We can either execute on the console or we can add it in the code. 
    since you are invoking your application after  dhcp is getting initialized, you can find a place in the code where the dhcp initialization is done successfully and  then invoke your application

    e.g,,  get the dhcp_server_status and then invoke your application
    sysevent get dhcp_server-status  // started
    sysevent async event_name $HANDLER


    For your reference, you can refer the below files on how to use the sysevent async to invoke a service.
    1. service_dhcp_server.sh
    2. service_crond.sh

    Thanks and Regards
    Srinivas

  3. Hi All,

    We are facing an issue that few ethernet lan clients when connected to cable modem box is not getting IP for example an windows client is getting IP but other client of same version of windows client is not able to get IP tried switching ports, factory rest etc, it is observed that the DHCP discover packet is not reaching the brlan0 interface. anyone faced this  kind of issue or any pointers to debug it further below layers is much appreciated.  Thanks