Browse Source

Sub environment vars in 'stop-command' (as well as 'command') setting

Somehow this got overlooked, it should definitely be done for
stop-command if for command.
Davin McCall 1 year ago
parent
commit
7331713319
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/load-service.cc

+ 3 - 0
src/load-service.cc

@@ -360,6 +360,7 @@ service_record * dirload_service_set::load_reload_service(const char *name, serv
 
         if (service_type == service_type_t::PROCESS) {
             do_env_subst("command", settings.command, settings.command_offsets, settings.do_sub_vars);
+            do_env_subst("stop-command", settings.stop_command, settings.stop_command_offsets, settings.do_sub_vars);
             std::vector<const char *> stop_arg_parts = separate_args(settings.stop_command, settings.stop_command_offsets);
             process_service *rvalps;
             if (create_new_record) {
@@ -394,6 +395,7 @@ service_record * dirload_service_set::load_reload_service(const char *name, serv
         }
         else if (service_type == service_type_t::BGPROCESS) {
             do_env_subst("command", settings.command, settings.command_offsets, settings.do_sub_vars);
+            do_env_subst("stop-command", settings.stop_command, settings.stop_command_offsets, settings.do_sub_vars);
             std::vector<const char *> stop_arg_parts = separate_args(settings.stop_command, settings.stop_command_offsets);
             bgproc_service *rvalps;
             if (create_new_record) {
@@ -424,6 +426,7 @@ service_record * dirload_service_set::load_reload_service(const char *name, serv
         }
         else if (service_type == service_type_t::SCRIPTED) {
             do_env_subst("command", settings.command, settings.command_offsets, settings.do_sub_vars);
+            do_env_subst("stop-command", settings.stop_command, settings.stop_command_offsets, settings.do_sub_vars);
             std::vector<const char *> stop_arg_parts = separate_args(settings.stop_command, settings.stop_command_offsets);
             scripted_service *rvalps;
             if (create_new_record) {