How to run a shell script before restarting a service in Monit in case of a crashMonit doesn't pick up httpd...
Are paving bricks differently sized for sand bedding vs mortar bedding?
Why is it that I can sometimes guess the next note?
What was the exact wording from Ivanhoe of this advice on how to free yourself from slavery?
What does routing an IP address mean?
Non-trope happy ending?
The screen of my macbook suddenly broken down how can I do to recover
A social experiment. What is the worst that can happen?
Has any country ever had 2 former presidents in jail simultaneously?
Can I sign legal documents with a smiley face?
What is the evidence for the "tyranny of the majority problem" in a direct democracy context?
What does chmod -u do?
Symbol used to indicate indivisibility
If magnesium reacts with oxygen to produce magnesium oxide only on the application of heat, then why isn't it categorised as an endothermic reaction?
Closed-form expression for certain product
It grows, but water kills it
Loading commands from file
How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?
Pre-modern battle - command it, or fight in it?
Why does the Sun have different day lengths, but not the gas giants?
Did Swami Prabhupada reject Advaita?
What are the purposes of autoencoders?
dpdt switch to spst switch
How do I color the graph in datavisualization?
Is it improper etiquette to ask your opponent what his/her rating is before the game?
How to run a shell script before restarting a service in Monit in case of a crash
Monit doesn't pick up httpd process after resetmysql monitoring with monitMonit not restarting serviceMonit runs exec action too oftenRestarting shell script with &disown using MonitMonit: How to optimally monitor an URLHow to watch a service with multiple processes with Monit?Awaken monit daemon every few hours for all monitored processesExecute custom monit script upon failure to restart the processMonit run script on restart
I am using Monit 5.3.2 in my Linux box. I am monitoring some services using Monit.
I want to run a script before the running the restart command.
I have used the below conditions for the same.
if does not exist for 2 times within 3 cycles then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser
if does not exist for 10 cycles then restart
Unfortunately only the restart action is getting executed.
Can anyone please help me to identify why the first rule is not executed ?
Is there are any other way to solve the problem ?
monit
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am using Monit 5.3.2 in my Linux box. I am monitoring some services using Monit.
I want to run a script before the running the restart command.
I have used the below conditions for the same.
if does not exist for 2 times within 3 cycles then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser
if does not exist for 10 cycles then restart
Unfortunately only the restart action is getting executed.
Can anyone please help me to identify why the first rule is not executed ?
Is there are any other way to solve the problem ?
monit
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am using Monit 5.3.2 in my Linux box. I am monitoring some services using Monit.
I want to run a script before the running the restart command.
I have used the below conditions for the same.
if does not exist for 2 times within 3 cycles then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser
if does not exist for 10 cycles then restart
Unfortunately only the restart action is getting executed.
Can anyone please help me to identify why the first rule is not executed ?
Is there are any other way to solve the problem ?
monit
I am using Monit 5.3.2 in my Linux box. I am monitoring some services using Monit.
I want to run a script before the running the restart command.
I have used the below conditions for the same.
if does not exist for 2 times within 3 cycles then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser
if does not exist for 10 cycles then restart
Unfortunately only the restart action is getting executed.
Can anyone please help me to identify why the first rule is not executed ?
Is there are any other way to solve the problem ?
monit
monit
asked Aug 23 '12 at 13:33
SupratikSupratik
99493259
99493259
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
This is not a definitive answer, as I am a newbie currently chasing down a similar problem.
I currently have a suspicion that the last rule overrides all previous rules.
If so, try:
if does not exist for 2 times within 3 cycles
then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser
ELSE if does not exist for 10 cycles then restart
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f420425%2fhow-to-run-a-shell-script-before-restarting-a-service-in-monit-in-case-of-a-cras%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is not a definitive answer, as I am a newbie currently chasing down a similar problem.
I currently have a suspicion that the last rule overrides all previous rules.
If so, try:
if does not exist for 2 times within 3 cycles
then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser
ELSE if does not exist for 10 cycles then restart
add a comment |
This is not a definitive answer, as I am a newbie currently chasing down a similar problem.
I currently have a suspicion that the last rule overrides all previous rules.
If so, try:
if does not exist for 2 times within 3 cycles
then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser
ELSE if does not exist for 10 cycles then restart
add a comment |
This is not a definitive answer, as I am a newbie currently chasing down a similar problem.
I currently have a suspicion that the last rule overrides all previous rules.
If so, try:
if does not exist for 2 times within 3 cycles
then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser
ELSE if does not exist for 10 cycles then restart
This is not a definitive answer, as I am a newbie currently chasing down a similar problem.
I currently have a suspicion that the last rule overrides all previous rules.
If so, try:
if does not exist for 2 times within 3 cycles
then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser
ELSE if does not exist for 10 cycles then restart
answered Aug 30 '12 at 3:01
OddthinkingOddthinking
18215
18215
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f420425%2fhow-to-run-a-shell-script-before-restarting-a-service-in-monit-in-case-of-a-cras%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown