Nagios external command not working



I have a shell script from where i am running the external to make some modifications in nagios.cfg file.
However, the changes are not made in .cfg file

#enable event notifications
/usr/bin/printf “%lu] ENABLE_NOTIFICATIONS\n” $dateis > $commandfile

#enable active serice checks
/usr/bin/printf “%lu] START_EXECUTING_SVC_CHECKS\n” $dateis > $commandfile

#enable active host checks
/usr/bin/printf “%lu] START_EXECUTING_HOST_CHECKS\n” $dateis > $commandfile

These are the parameter values in nagios.cfgfile


prw-rw---- 1 nagios apache 0 Oct 1 00:18 /var/log/nagios/rw/nagios.cmd

What am i missing here?

Thanks for helping me



hmm, are you sure you want to do that? nagios.cfg is the main configuration
file for global parameters. I don’t think it is possible to make changes in this
file via external commands. External commands are used to modify individual
nagios objects. Here is practical and working example with detailed explanations: