freebsd-dev/etc/periodic/daily/200.backup-passwd
Dag-Erling Smørgrav 1d70d1dd0a Add a chkgrp run after backing up the passwd and group files.
Suggested-by: Andreas Klemm
1998-05-24 15:57:31 +00:00

42 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
#
# $Id: 200.backup-passwd,v 1.1.1.1 1997/08/16 17:04:00 pst Exp $
#
bak=/var/backups
if [ -f /etc/master.passwd -o -f /etc/group ] ; then
echo ""
echo "Backup passwd and group files:"
if [ ! -f $bak/master.passwd.bak ] ; then
echo "no $bak/master.passwd.bak"
cp -p /etc/master.passwd $bak/master.passwd.bak
fi
if cmp -s $bak/master.passwd.bak /etc/master.passwd; then :; else
echo "$host passwd diffs:"
diff $bak/master.passwd.bak /etc/master.passwd |\
sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/'
mv $bak/master.passwd.bak $bak/master.passwd.bak2
cp -p /etc/master.passwd $bak/master.passwd.bak
fi
if [ ! -f $bak/group.bak ] ; then
echo "no $bak/group.bak"
cp -p /etc/group $bak/group.bak
fi
if cmp -s $bak/group.bak /etc/group; then :; else
echo "$host group diffs:"
diff $bak/group.bak /etc/group
mv $bak/group.bak $bak/group.bak2
cp -p /etc/group $bak/group.bak
fi
if [ -f /etc/group ] ; then
echo ""
echo "Verifying group file syntax:"
chkgrp /etc/group
fi
fi