-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement --program option in crashmail
- Loading branch information
Showing
7 changed files
with
90 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
To test | ||
- copy crashin fakemail to /R/bin | ||
- copy crashmail.conf testcrash.conf testcrash2.conf to /etc/supervisor/conf.d | ||
|
||
monitor log files in /L/ | ||
- You'll get an 'Ignoring hostname: testcrash' message every 10s in /L/crashmail.log (testcrash) | ||
|
||
- You'll get 2 'unexpected exit, mailing' message every 30s in /L/crashmail.log (notifycrash:testcrash2, notifycrash:testcrash3) | ||
and the message in /L/fakemail.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
# test program: non 0 exit code after timeout | ||
timeout="$1" | ||
echo $(date) "Crashing in $timeout seconds" | ||
sleep "$timeout" | ||
echo $(date) "CRASHING NOW" | ||
exit 123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# config to use the fakemail mail sender | ||
# and monitor only testcrash2 (crashes every 30s) | ||
[eventlistener:crashmail] | ||
command = | ||
/usr/local/bin/crashmail | ||
-p notifycrash:* | ||
-o hostname -m [email protected] | ||
-s '/R/bin/fakemail -t -i -f [email protected]' | ||
events=PROCESS_STATE_EXITED | ||
stderr_logfile=/L/crashmail.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# don't send any mail: only write the args and stdin to the logfile | ||
logfile=/L/fakemail.log | ||
echo $(date) "$*" >> "$logfile" | ||
cat >> "$logfile" | ||
echo >> "$logfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# test program: crashes every 10 seconds | ||
[program:testcrash] | ||
command=/R/bin/crashin 10 | ||
|
||
autostart=true | ||
autorestart=true | ||
|
||
stdout_logfile=/L/testcrash.log | ||
redirect_stderr=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[group:notifycrash] | ||
programs=testcrash2,testcrash3 | ||
|
||
# test program: crashes every 30 seconds | ||
[program:testcrash2] | ||
command=/R/bin/crashin 30 | ||
|
||
autostart=true | ||
autorestart=true | ||
|
||
stdout_logfile=/L/testcrash2.log | ||
redirect_stderr=true | ||
|
||
[program:testcrash3] | ||
command=/R/bin/crashin 33 | ||
|
||
autostart=true | ||
autorestart=true | ||
|
||
stdout_logfile=/L/testcrash3.log | ||
redirect_stderr=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters