]> git.draconx.ca Git - scripts.git/blob - spamassassin.zsh
Add script to convert "JWK"-format RSA keys to normal.
[scripts.git] / spamassassin.zsh
1 #!/usr/bin/env zsh
2
3 # Copyright © 2011 Nick Bowler
4 #
5 # Check mail for spam, automatically spawning spamd as necessary.  This
6 # script can therefore be used in a procmail recipe to efficiently handle
7 # spam filtering.
8 #
9 # Runs plain old spamassassin if the daemon cannot be started for any reason.
10 #
11 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
12 # This is free software: you are free to do what the fuck you want to.
13 # There is NO WARRANTY, to the extent permitted by law.
14
15 spamd_sock=$HOME/.spamd
16 spamd_log=$HOME/.spamdlog
17 spamd_pid=$HOME/.spamdpid
18 spamd=/usr/sbin/spamd
19
20 run_spamd() {
21         flock -n $spamd_pid $spamd --pidfile=$spamd_pid --syslog=$spamd_log \
22                                    --socketpath=$spamd_sock $@
23 }
24
25 if ! spamc -K -U $spamd_sock &>/dev/null; then
26         run_spamd --daemonize || exec spamassassin
27 fi
28
29 exec spamc -U $spamd_sock