log errors to syslog
This commit is contained in:
parent
f58c0e8b11
commit
3b7f104601
|
@ -11,14 +11,18 @@ GETMAIL_DIR=/var/lib/getmail
|
||||||
# Otherwise 'supervisorctl restart getmail' leads to zombie 'sleep' processes.
|
# Otherwise 'supervisorctl restart getmail' leads to zombie 'sleep' processes.
|
||||||
trap 'pkill --parent $$' EXIT
|
trap 'pkill --parent $$' EXIT
|
||||||
|
|
||||||
|
function _syslog_error() {
|
||||||
|
logger --id --priority mail.err -t getmail6 "$*"
|
||||||
|
}
|
||||||
|
|
||||||
function _stopService() {
|
function _stopService() {
|
||||||
_log 'warn' "Stopping getmail service"
|
_syslog_error "Stopping service"
|
||||||
exec supervisorctl stop getmail
|
exec supervisorctl stop getmail
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify the correct value for GETMAIL_POLL. Valid are any numbers greater than 0.
|
# Verify the correct value for GETMAIL_POLL. Valid are any numbers greater than 0.
|
||||||
if ! [[ ${GETMAIL_POLL} =~ ^[0-9]+$ && ${GETMAIL_POLL} -gt 0 ]]; then
|
if ! [[ ${GETMAIL_POLL} =~ ^[0-9]+$ && ${GETMAIL_POLL} -gt 0 ]]; then
|
||||||
_log 'warn' "Invalid value for GETMAIL_POLL: ${GETMAIL_POLL}"
|
_syslog_error "Invalid value for GETMAIL_POLL: ${GETMAIL_POLL}"
|
||||||
_stopService
|
_stopService
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -35,7 +39,7 @@ while :; do
|
||||||
|
|
||||||
# Stop service if no configuration is found.
|
# Stop service if no configuration is found.
|
||||||
if [[ -z ${RC_FILE} ]]; then
|
if [[ -z ${RC_FILE} ]]; then
|
||||||
_log 'warn' 'No getmail configration found'
|
_syslog_error 'No configration found'
|
||||||
_stopService
|
_stopService
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue