Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#! /usr/bin/perl -w
use strict;
my $host = `uname -n`;
chomp $host;
sub send_message
{
my ( $user, $message ) = @_;
open FH, "|mail -s \"Password on $host\" $user\@mailserver"
or die "Unable to open pipe to mail\n";
print FH $message;
close FH;
}
# I'm only interested in users in the group 'helpdesk'
foreach my $user ( split /[,=\n]/, `lsgroup -a users helpdesk` )
{
$user =~ /^helpdesk/ and next; #not intersted in the generic helpdesk user
#use lssec to extract last update
my (undef,$chtime) = split /[=\n]/, `lssec -f /etc/security/passwd -s $user -a lastupdate 2>/dev/null`;
# ignore those who have never updated (new or unused)
$chtime or (print STDERR "$user has never been updated\n"), next;
#calc days from now
$chtime = int ((time - $chtime)/( 60 * 60 * 24 ));
# ignore if changed in last 42 days
$chtime < 42 and next;
# if more than 56 days send expirey message
( $chtime = 56 - $chtime ) <= 0 and
send_message $user, "Your password on $host has expired"
or #send about to expire message
send_message $user, "Your password on $host will expire in $chtime days - please log in and reset it";
}