SHA256
1
0
forked from pool/fetchmail
fetchmail/fetchmail.exec
P. Janouch 60bce8b149 - Made the helper script introduced in last change return exit status
5 on configuration errors instead of 1, which should make it a bit
  less confusing (bsc#979534)

OBS-URL: https://build.opensuse.org/package/show/server:mail/fetchmail?expand=0&rev=68
2016-05-13 12:12:11 +00:00

22 lines
703 B
Bash

#!/bin/sh
# fetchmail-systemd-exec: sysconfig helper script for systemd
die() {
echo "$@" 1>&2
exit 5 # closest thing among fetchmail's exit codes
}
echo "$FETCHMAIL_POLLING_INTERVAL" | grep -Eq '^[0-9]+$' \
|| die 'invalid $FETCHMAIL_POLLING_INTERVAL setting'
[ -r "$FETCHMAIL_RC_PATH" ] \
|| die '$FETCHMAIL_RC_PATH does not exist or cannot be read'
OPTS="-d $FETCHMAIL_POLLING_INTERVAL"
[ "$FETCHMAIL_FETCHALL" = "yes" ] && OPTS="$OPTS -a"
[ "$FETCHMAIL_SILENT" = "yes" ] && OPTS="$OPTS -s"
[ "`whoami`" = "fetchmail" -a -z "$FETCHMAILHOME" ] && \
export FETCHMAILHOME=/var/lib/fetchmail
exec /usr/bin/fetchmail $OPTS $FETCHMAIL_EXPERT_OPTIONS \
-f $FETCHMAIL_RC_PATH -L /var/log/fetchmail