In this example, we report passwd and shadow file problems as found by the standard pwck program. Although you might use other means to monitor and report problems with the /etc/passwd and /etc/shadow files--for example, utilize the Pikt script PasswdFileProblems--you might also want to consult pwck for added reassurance.
The Pwck script might send an alert message like the following:
PIKT ALERT Mon Oct 20 02:49:19 2003 ankara WARNING: Pwck Report /etc/passwd & /etc/shadow file problems as found by pwck no matching password file entry delete line `staff:!:12515:0:99999:7:::'? No
The script follows.
Pwck init status =piktstatus level =piktlevel task "Report /etc/passwd & /etc/shadow file problems as found by pwck" input proc "=pwck -r 2>&1 | =egrep -v 'no changes'" rule output mail $inlin
In this script, the pwck program does the real work. We wrap pwck within the Pwck Pikt script to take advantage of PIKT's scheduling, reporting, and logging facilities.
For more examples, see Samples.