[Techtalk] script for sending mail when password about to expire

Wim De Smet kromagg at gmail.com
Thu Sep 16 18:50:07 EST 2004


Hi,
On Wed, 15 Sep 2004 09:39:34 +1000, John Clarke
<johnc+linuxchix at kirriwa.net> wrote:
> On Tue, Sep 14, 2004 at 03:21:17 -0700, Maria McKinley wrote:
> 
> > I would like to make a script that sends a mail to users when their
> > password is about to expire.  In ldap the password expiration date is
> > stored as days since January 1, 1970.  Is there an easy way to check the
> > current date in days since January 1, 1970 in a shell script?  It looks
> 
> You can get the current time in seconds since 1st Jan 1970 with "date
> +%s", and you can do arithmetic in bash with $((...)).  This script:
> 
>     #!/bin/sh
> [...]

Not to be pedantic or anything, but this will fail on systems where
bash is not the default shell. It might be better to start with
#!/bin/bash.

greets,
Wim


More information about the Techtalk mailing list