Results 1 to 2 of 2

Thread: Looking for a user expires @ date

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Question Account Expiration Notification (using mutt) autoscript

    Looking for a user expires at date

    My idea is

    1. user a (
    wil be expire - example 01/01/2013 - script must send a email to this person automatic 3 times
    - 3 weeks before
    - 2 weeks before
    - 1 day before
    2. user b
    3. user c
    4. user d
    5. user e
    6. user f
    7. user g
    8. user h
    9. user i
    10. user j

    So the base of this example, we have a user+date this list i have made allready

    example:
    1: linuxbuddy1
    1: 01-01-2013
    1: emailadress 1(example)
    2: linuxbuddy2
    2: 01-01-2013
    2: emailadress2 (example)
    3: linuxbuddy3
    3: 01-01-2013
    3: emailadress3 (example)
    4: linuxbuddy4
    4: 01-01-2013
    4: emailadress4 (example)


    The email must be send also to a emailadress webmaster

    I hope i this is the info you all need who/want can/to help?

    The script must check the dates en send a alert
    Last edited by linuxbuddy; 14th November 2012 at 03:58 AM.

  2. #2
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    This script looks a lot to the final, but don't have any idea


    #!/bin/bash

    #Author:Surendra Kumar Anne
    #Created on:09-02-2012#Purpose:To check the user account expire status in Linux, unix, BSD etccat /etc/shadow | cut -d: -f1,8 | sed /:$/d > /tmp/expirelist.txttotalaccounts=`cat /tmp/expirelist.txt | wc -l`for((i=1; i<=$totalaccounts; i++ )) do tuserval=`head -n $i /tmp/expirelist.txt | tail -n 1` username=`echo $tuserval | cut -f1 -d:` userexp=`echo $tuserval | cut -f2 -d:` userexpireinseconds=$(( $userexp * 86400 )) todaystime=`date +%s` #check if the user expired or not? if [ $userexpireinseconds -ge $todaystime ] ; then timeto7days=$(( $todaystime + 604800 )) if [ $userexpireinseconds -le $timeto7days ]; then mail -s "The account $username will expire less than 7 days" root fi else mail -s "The user account $username already expired" root fidone

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 20th November 2012, 10:22 AM
  2. Find next date from a specific date
    By nbhadauria in forum Shell scripting
    Replies: 1
    Last Post: 15th May 2012, 03:53 PM
  3. Did a LDAP user user login window machine
    By Jitenderana in forum Linux software
    Replies: 2
    Last Post: 17th November 2011, 10:02 AM
  4. Replies: 1
    Last Post: 2nd March 2009, 05:02 PM
  5. Shell date command for manipulation and formatting date
    By newbie4 in forum Shell scripting
    Replies: 4
    Last Post: 28th October 2008, 08:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •