File: opendmarc-importstats

package info (click to toggle)
opendmarc 1.3.0%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,480 kB
  • ctags: 913
  • sloc: xml: 19,673; ansic: 12,748; sh: 10,976; perl: 2,060; makefile: 194; python: 58
file content (26 lines) | stat: -rwxr-xr-x 648 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
##
## Copyright (c) 2012, The Trusted Domain Project.  All rights reserved.
##
## opendmarc-importstats -- import opendmarc output to MySQL
##
## This is intended to be used via a crontab.  If import is successful,
## this code exits quietly so there's no output.  If it fails, it does
## "ls -l" on the temporary file, so that cron generates mail to whever
## ran the job.

## setup
statsdb="/var/tmp/dmarc.dat"
# OPENDMARC_PASSWORD="password"; export OPENDMARC_PASSWORD

if [ -s $statsdb ]
then
	mv $statsdb ${statsdb}.OLD.$$

	if opendmarc-import < ${statsdb}.OLD.$$
	then
		rm ${statsdb}.OLD.$$
	else
		ls -l ${statsdb}.OLD.$$
	fi
fi