Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

Custom Commands in Domino Start Script

Daniel Nashed  17 January 2014 11:00:38
Most of the new functionality in my start scripts is based on my own ideas and requests I get from customer projects.
For each of the request for new functionality I am trying to find out a way to make it as customizable as possible to make it fit for different customer environments.


On the other side there are still requests which are very customer specific which I cannot build into a standard script.
But I also would like to keep the script in a maintainable mode where you have only to switch to a newer script (rc_domino_script) without re-adding customization in the code.


The first step I did was a call-back functionality where you can add your own scripts before or after a certain event (server start, server stop, ...).
So all kind of customization can be done in your own extension scripts.


But there are still cases where customers need their own "commands" added to the start script.

So when driving back in the car last night from a customer I had a new idea how it could be more flexible.

In the next version of the start script I am planning to have a away to plug-in your own custom commands using separate shell-scripts for each of the commands.
So you would just configure a directory where my start script should look for your own commands and if they are executable the start script will run the command.
The scripts would inherit all variables from the start script.


Right now in my first test version the script first checks for build in commands and if the command is not known by the script it checks the extension directory for a script name matching the command.
In theory I could first check the directory and it could be possible to override standard functionality.  But I am not sure if I want to go that far. What do you think?


In general this new functionality would encapsulate all changes and extensions in separate scripts but you would still have the flexible.
I will build this into the next version anyway. But I am interested in your feedback about details of the implementation and if you want also be able to override standard commands.


Here is how I currently have implemented it in my first version.

If you have your own customization in the start script and want to still participate in regular updates, I think the plug-in functionality I added earlier and this new functionality might be helpful.
I am really interested in feedback either here or by email.


-- Daniel


  *)
 
    if [ -z "$DOMINO_CUSTOM_COMMAND_BASEPATH" ]; then
      DebugText "Invalid PARAM1:" [$PARAM1]
      echo
      echo "Invalid command:" [$PARAM1]
      usage
      exit 1
    fi

    DOMINO_CUSTOM_COMMAND_SCRIPT="$DOMINO_CUSTOM_COMMAND_BASEPATH/$PARAM1"
    DebugText "DOMINO_CUSTOM_COMMAND_SCRIPT:" [$DOMINO_CUSTOM_COMMAND_SCRIPT]

    if [ -x $DOMINO_CUSTOM_COMMAND_SCRIPT ]; then
      # execute custom command
      DebugText "-- before executing custom command"
      $DOMINO_CUSTOM_COMMAND_SCRIPT "$PARAM2" "$PARAM3" "$PARAM4" "$PARAM5" "$PARAM6"
      DebugText "-- after executing custom command"

    else
      DebugText "Invalid PARAM1:" [$PARAM1]
      echo
      echo "Invalid command:" [$PARAM1]
      usage
      exit 1
    fi
 
    ;;
Comments

1Jan Flipsen  03.02.2014 22:19:17  Custom Commands in Domino Start Script

Great idea Daniel, it was your explaintion at linuxfest , which gave me the right understanding of the possibility's.


  • [IBM Lotus Domino]
  • [Domino on Linux]
  • [Nash!Com]
  • [Daniel Nashed]