~ubuntu-branches/ubuntu/trusty/nagios-plugins-contrib/trusty-proposed

« back to all changes in this revision

Viewing changes to check_checksums/update_checksums

  • Committer: Package Import Robot
  • Author(s): Bernd Zeimetz, Bernd Zeimetz, Jan Wagner, Evgeni Golov
  • Date: 2013-06-14 20:53:49 UTC
  • Revision ID: package-import@ubuntu.com-20130614205349-34xiy38pm1hzpjoi
Tags: 7.20130614
[ Bernd Zeimetz ]
* [036816ff] Merge pull request #15 from evgeni/master
  check_packages should find security updates on the official security mirror too
* [658a2e93] Add check_checksums nagios plugin.
* [9d5d2056] Updating check_raid.
* [e3ec1293] Updating check_ssl_cert to 1.14.6
* [779543ef] Updating check_hpasm to 4.6.3.2
* [0c838ee9] Updating check_multipath to 0.1.9
* [bec11251] Updating check_whois to 1.13
* [8e0a65d0] Refreshing patches.
* [c0b88cdb] Auto update of debian/copyright
* [59648a17] Fix src link for check_hpasm
* [8c242d0f] Support pre-Wheezy versions of coretutils in check_checksums.
* [7d3d2a06] Update release date in changelog (gah!).
* [768e463b] Merge pull request #16 from evgeni/master
  check_libs: ignore /var/lib/postgresql/ and /var/log/
* [2b9aace5] Bumping standards-Verison, no changes needed.

[ Jan Wagner ]
* [3bb873e4] disable epn for check_rbl

[ Evgeni Golov ]
* [2a7ab4b8] check_libs: ignore /var/spool/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
#    Tool to rebuild all checksums for check_checksums
 
4
#
 
5
#
 
6
#    Copyright (C) 2013 Bernd Zeimetz <b.zeimetz@conova.com>
 
7
#
 
8
#    This program is free software: you can redistribute it and/or modify
 
9
#    it under the terms of the GNU General Public License as published by
 
10
#    the Free Software Foundation, either version 3 of the License, or
 
11
#    (at your option) any later version.
 
12
#
 
13
#    This program is distributed in the hope that it will be useful,
 
14
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
#    GNU General Public License for more details.
 
17
#
 
18
#    You should have received a copy of the GNU General Public License
 
19
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
 
 
21
set -e
 
22
umask 027
 
23
 
 
24
for t in md5 sha1 sha224 sha256 sha384 sha512; do
 
25
    fname="/etc/nagios/check_checksums.${t}"
 
26
    tool="${t}sum"
 
27
    if [ -f ${fname} ]; then
 
28
        tmp=`mktemp`
 
29
        chown root:nagios ${tmp}
 
30
 
 
31
        trap "rm -f ${tmp}" EXIT
 
32
 
 
33
        sed 's,^[^ ]*  ,,' ${fname} | while read f; do
 
34
            if [ -f "${f}" ]; then
 
35
                ${tool} ${f} >> ${tmp}
 
36
            else
 
37
                echo "${f} went missing, ignoring!"
 
38
            fi
 
39
        done
 
40
 
 
41
        ln "${fname}" "${fname}_`date '+%s'`"
 
42
        mv "${tmp}" "${fname}"
 
43
    fi
 
44
done
 
45
 
 
46