Mon, 18 Feb 2013 19:47:24 +0100
Fixed check mailq on ssmtp systems
5 | 1 | #!/bin/bash |
2 | # | |
3 | ############################################################################# | |
16
37f217a8bcce
Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents:
14
diff
changeset
|
4 | # Copyright (C) 2005-2013 |
5 | 5 | # |
16
37f217a8bcce
Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents:
14
diff
changeset
|
6 | # Michiel Broek <mbse at mbse.eu> |
5 | 7 | # the Netherlands |
8 | # | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
5
diff
changeset
|
9 | # This file is part of SlackSecCheckScripts. |
5 | 10 | # |
11 | # This package is free software; you can redistribute it and/or modify it | |
12 | # under the terms of the GNU General Public License as published by the | |
13 | # Free Software Foundation; either version 2, or (at your option) any | |
14 | # later version. | |
15 | # | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
5
diff
changeset
|
16 | # SlackSecCheckScripts is distributed in the hope that it will be useful, but |
5 | 17 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | # General Public License for more details. | |
20 | # | |
21 | # You should have received a copy of the GNU General Public License | |
22 | # along with MBSE BBS; see the file COPYING. If not, write to the Free | |
23 | # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
24 | ############################################################################# | |
25 | ||
16
37f217a8bcce
Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents:
14
diff
changeset
|
26 | # If the system is using ssmtp then there is no queue to check |
37f217a8bcce
Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents:
14
diff
changeset
|
27 | [ -x /usr/sbin/ssmtp ] && exit |
37f217a8bcce
Fixed check mailq on ssmtp systems
Michiel Broek <mbroek@mbse.eu>
parents:
14
diff
changeset
|
28 | |
5 | 29 | PATH=/sbin:/usr/sbin:/bin:/usr/bin |
30 | ||
31 | umask 077 | |
32 | TZ=UTC; export TZ | |
33 | LANG=C; export LANG | |
34 | ||
35 | SECUREDIR=`mktemp -d /tmp/_securedir.XXXXXX` || exit 1 | |
36 | ||
37 | trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE | |
38 | ||
39 | if ! cd "$SECUREDIR"; then | |
40 | echo "Can not cd to $SECUREDIR". | |
41 | exit 1 | |
42 | fi | |
43 | ||
44 | TMP=$SECUREDIR/tmp | |
45 | ||
46 | # Check mailqueue | |
47 | # | |
48 | mailq > $TMP | |
49 | if ! grep -q "queue is empty$" $TMP; then | |
50 | echo "" | |
51 | echo "mail:" | |
52 | cat $TMP | |
53 | fi | |
54 |