Bliss, Aaron wrote:
/etc/profile should work just fine. I thought this might be helpful to other users (perl script was tough for me, as I've never really scripted in perl but couldn't figure out a way to do in bash), so here you go:
As it turns out, perl hacking is my hobby :-) Here is your script, improved a bit, and with command line option parsing included.
#!/usr/bin/perl -w use strict; use Getopt::Long; use Time::Local; my %o; GetOptions( \%o, 'year=i', 'month=i', 'day=i', ); my $year = $o{year}; # exp year my $month = $o{month}; # exp month my $day = $o{day}; # exp day if (!($year && $month && $day)) { die "Usage: $0 --year YYYY --month MM --day DD\n"; } my $maxyear = 2038; # highest year for 32-bit systems my $warning = 14; # warning window in days if ($year >= $maxyear) { die "Max year is $maxyear\n" } $month -= 1; my $ep_exp = timelocal(0,0,0,$day,$month,$year); my $ep_cur = timelocal(0,0,0, (localtime(time)) [3,4,5]); # calculate the difference and send a warning if necessary my $days = ($ep_exp - $ep_cur) / 86400; if ($days <= $warning) { print "Warning: Your LDAP password expires in $days days\n"; } -- mike -- Fedora-directory-users mailing list Fedora-directory-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-directory-users