Skip to content

watch config-file changes and reload monit - #2

Open
MaZderMind wants to merge 4 commits into
rawmind0:masterfrom
MaZderMind:reload-on-config-change
Open

watch config-file changes and reload monit#2
MaZderMind wants to merge 4 commits into
rawmind0:masterfrom
MaZderMind:reload-on-config-change

Conversation

@MaZderMind

Copy link
Copy Markdown

automatically reload monit when a config-file is changed


echo "Starting config change watch"
/usr/bin/env bash ${MONIT_HOME}/bin/monit-watch-config-changes.sh &

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think if it's optional??

+MONIT_RELOAD=${MONIT_RELOAD:-"false"}
-echo "Starting config change watch"
-/usr/bin/env bash ${MONIT_HOME}/bin/monit-watch-config-changes.sh &
+if [ "${MONIT_RELOAD" -eq "true" ]; then
+    echo "Starting config change watch"
+    /usr/bin/env bash ${MONIT_HOME}/bin/monit-watch-config-changes.sh &
+fi

@rawmind0

rawmind0 commented Aug 2, 2017

Copy link
Copy Markdown
Owner

Hi @MaZderMind ... thanks so much for the PR... :)

What do you thin to make the feature optional?? Please, take a look at the change request.

@MaZderMind

Copy link
Copy Markdown
Author

@rawmind0 sure, I modified the script accordingly.
This time I also was awake enough to update the README and include a check for config validity before HUPing monit (it would go into a crash-loop otherwise). I also reduced the sensitivity on the inotifywait to not trigger eon swap-file creation (nano/vim) or on access/open events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants