<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: password expiry script (For loops send multiple emails) in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620798#M675809</link>
    <description>Sorry for that, however that is solving my problem. Since the email sent does not go as expected. &lt;BR /&gt;The email should go 8 days prior to expiry but when put outside the loop it will go every week as scheduled in the cron. So the problem is still there though if I put it outside the loop.</description>
    <pubDate>Tue, 20 Apr 2010 13:23:30 GMT</pubDate>
    <dc:creator>kpatel786</dc:creator>
    <dc:date>2010-04-20T13:23:30Z</dc:date>
    <item>
      <title>password expiry script (For loops send multiple emails)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620795#M675806</link>
      <description>We have standard password expiry script. The for loop below sends multiple appending userlist emails. &lt;BR /&gt;&lt;BR /&gt;for USER in $(cat /sysadmin/scripts/user_list_dba)&lt;BR /&gt;do&lt;BR /&gt;   user_aging=$(/usr/lbin/getprpw -r -m exptm $USER)&lt;BR /&gt;   if [ $user_aging -eq "0" ]&lt;BR /&gt;   then&lt;BR /&gt;     print "\nUser $USER does not have password aging enabled."&lt;BR /&gt;     continue&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;   if [ $system_wide_aging -eq 0 ]&lt;BR /&gt;   then&lt;BR /&gt;     if [ $user_aging -eq "-1" ]&lt;BR /&gt;     then&lt;BR /&gt;       print "\nUser $USER does not have password aging enabled."&lt;BR /&gt;       continue&lt;BR /&gt;     fi&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;   U=$(echo $USER|cut -c 1)&lt;BR /&gt;&lt;BR /&gt;   exp=$(logins -x -l $USER | tail -1 | awk '{print $4}')&lt;BR /&gt;   ((exp_time = exp * 86400))&lt;BR /&gt;   current_time=$(/sysadmin/scripts/time)&lt;BR /&gt;&lt;BR /&gt;   passwd_changed=$(grep u_succhg /tcb/files/auth/$U/$USER)&lt;BR /&gt;   if [ $? = 1 ]&lt;BR /&gt;   then&lt;BR /&gt;        echo "User $USER        :       password expired\n\n" &amp;gt;&amp;gt; $REPORT_FILE&lt;BR /&gt;     print "\nUser $USER does not have valid last successful password"&lt;BR /&gt;     print "change date. This can happen if tsconvert is used on"&lt;BR /&gt;     print "the command line to convert the system, instead of SAM."&lt;BR /&gt;     continue&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;   last_change=$(grep u_succhg /tcb/files/auth/$U/$USER | \&lt;BR /&gt;                 awk -F "u_succhg#" ' {print $2}' |\&lt;BR /&gt;                 awk -F ":" ' {print $1}' )&lt;BR /&gt;&lt;BR /&gt;   ((exp_date = last_change + exp_time))&lt;BR /&gt;   ((time_left = exp_date - current_time))&lt;BR /&gt;   ((days_left = time_left / seconds_per_day))&lt;BR /&gt;&lt;BR /&gt;   last_change_date=$(getprpw -r -m spwchg $USER)&lt;BR /&gt;   expire_date=$(echo 0d${exp_date}=Y | adb -o | cut -c 17-27)&lt;BR /&gt;set -x&lt;BR /&gt;#   if [ $days_left -gt 1 ] and [ $days_left -lt 8 ]# hashed to test 18-11-09&lt;BR /&gt;#   if [ $days_left -lt 9 ]# changed for test&lt;BR /&gt;    if [ "$days_left" -lt "9" ]&lt;BR /&gt;   then&lt;BR /&gt;     print "User $USER on $HOST has $days_left days left until password expires."&lt;BR /&gt;     print "User $USER on $HOST last changed the password on: $last_change_date."&lt;BR /&gt;     print "User $USER on $HOST - password will expire on: $expire_date.\n"&lt;BR /&gt;        echo "User $USER        :       password will expire on $expire_date\n\n" &amp;gt;&amp;gt; $REPORT_FILE&lt;BR /&gt;MAILTO="DL-OffshoreHP-UX@candid.co.uk"&lt;BR /&gt;mailx -s "HOST1 Password_Status" $MAILTO &amp;lt; $REPORT_FILE&lt;BR /&gt;   else&lt;BR /&gt;     print "User $USER: password has expired\n"&lt;BR /&gt;        echo "User $USER        :       password expired\n\n" &amp;gt;&amp;gt; $REPORT_FILE&lt;BR /&gt;     # modprpw -l -v $USER&lt;BR /&gt;   fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Please assist, as I require only one consolidate mail to go rather than multiple mails. &lt;BR /&gt;</description>
      <pubDate>Tue, 20 Apr 2010 12:59:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620795#M675806</guid>
      <dc:creator>kpatel786</dc:creator>
      <dc:date>2010-04-20T12:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: password expiry script (For loops send multiple emails)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620796#M675807</link>
      <description>instead of emailing in the loop, send the output from each if statement to a file.&lt;BR /&gt;&lt;BR /&gt;At the end cat(or attach) the file(s) into an email.</description>
      <pubDate>Tue, 20 Apr 2010 13:07:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620796#M675807</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2010-04-20T13:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: password expiry script (For loops send multiple emails)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620797#M675808</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You asked this very question here (my memory is quite good, you see):&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1403117" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1403117&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;... AND I offered you a solution then.  Please re-evaluate the thread above and if you are happy with the answers, read and follow:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/helptips.do?#28" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/helptips.do?#28&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Apr 2010 13:12:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620797#M675808</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-04-20T13:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: password expiry script (For loops send multiple emails)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620798#M675809</link>
      <description>Sorry for that, however that is solving my problem. Since the email sent does not go as expected. &lt;BR /&gt;The email should go 8 days prior to expiry but when put outside the loop it will go every week as scheduled in the cron. So the problem is still there though if I put it outside the loop.</description>
      <pubDate>Tue, 20 Apr 2010 13:23:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620798#M675809</guid>
      <dc:creator>kpatel786</dc:creator>
      <dc:date>2010-04-20T13:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: password expiry script (For loops send multiple emails)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620799#M675810</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; The email should go 8 days prior to expiry but when put outside the loop it will go every week as scheduled in the cron. So the problem is still there though if I put it outside the loop.&lt;BR /&gt;&lt;BR /&gt;Move the 'mailx' call outside the loop.  Modify your 'crontab' to run every day instead of weekly.&lt;BR /&gt;&lt;BR /&gt;You can test for an empty REPORT_FILE and skip the mailing if there are no candidates meeting your criteria.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 20 Apr 2010 13:32:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620799#M675810</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-04-20T13:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: password expiry script (For loops send multiple emails)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620800#M675811</link>
      <description>The problem is there is no empty file. The file gets updated with some or other output. Have tried the above option the email anyway goes with the user list, in this case for more than 8 days expiry.&lt;BR /&gt;For which I have been receiving quite a few bashing from the users :-(&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Apr 2010 13:38:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620800#M675811</guid>
      <dc:creator>kpatel786</dc:creator>
      <dc:date>2010-04-20T13:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: password expiry script (For loops send multiple emails)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620801#M675812</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; The problem is there is no empty file. The file gets updated with some or other output. &lt;BR /&gt;&lt;BR /&gt;Fine, then change your script to use new file *only* to collect your password expiration candidates.  Then, test that file for emptiness.  If there is data in the file, append it (if necessary) to the '${REPORT_FILE}' and send the whole thing.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 20 Apr 2010 13:46:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620801#M675812</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-04-20T13:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: password expiry script (For loops send multiple emails)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620802#M675813</link>
      <description>Thanks I will try that.</description>
      <pubDate>Tue, 20 Apr 2010 14:01:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/password-expiry-script-for-loops-send-multiple-emails/m-p/4620802#M675813</guid>
      <dc:creator>kpatel786</dc:creator>
      <dc:date>2010-04-20T14:01:45Z</dc:date>
    </item>
  </channel>
</rss>

