3
# Tool to rebuild all checksums for check_checksums
6
# Copyright (C) 2013 Bernd Zeimetz <b.zeimetz@conova.com>
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.
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.
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/>.
24
for t in md5 sha1 sha224 sha256 sha384 sha512; do
25
fname="/etc/nagios/check_checksums.${t}"
27
if [ -f ${fname} ]; then
29
chown root:nagios ${tmp}
31
trap "rm -f ${tmp}" EXIT
33
sed 's,^[^ ]* ,,' ${fname} | while read f; do
34
if [ -f "${f}" ]; then
35
${tool} ${f} >> ${tmp}
37
echo "${f} went missing, ignoring!"
41
ln "${fname}" "${fname}_`date '+%s'`"
42
mv "${tmp}" "${fname}"