<?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: last login script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526348#M24416</link>
    <description>James,&lt;BR /&gt;&lt;BR /&gt;Close, but not yet.  Am I missing something?&lt;BR /&gt;This is the script that I am using.&lt;BR /&gt;Unfortunately, it does not sort by date, which is what I was looking for.&lt;BR /&gt;&lt;BR /&gt;Should I use runacct instead?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;#&lt;BR /&gt;LOG=/tmp/last.log&lt;BR /&gt;IFS=:&lt;BR /&gt;#&lt;BR /&gt;rm -f $LOG&lt;BR /&gt;#&lt;BR /&gt;while read USER NULL&lt;BR /&gt;do&lt;BR /&gt;  last -1 $USER | awk 'NF &amp;gt; 6 {print $0}' &amp;gt;&amp;gt; $LOG&lt;BR /&gt;done &amp;lt; /etc/passwd&lt;BR /&gt;#&lt;BR /&gt;sort -o $LOG -Mrk4 -krn5 -krn6.1,6.2 -krn6.4 -kb1 $LOG&lt;BR /&gt;#&lt;BR /&gt;#.jrf.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 14 May 2001 11:34:41 GMT</pubDate>
    <dc:creator>Nick D'Angelo</dc:creator>
    <dc:date>2001-05-14T11:34:41Z</dc:date>
    <item>
      <title>last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526339#M24407</link>
      <description>I have an awk script that I have created to check the last time users have logged in.&lt;BR /&gt;&lt;BR /&gt;awk -F: '{print "last | grep "$1" | head -1"}' /etc/passwd|ksh - &amp;gt; /home1/nickd/lastlogin&lt;BR /&gt;&lt;BR /&gt;The missing piece is to sort the output file so that the file is sorted from newest to oldest.&lt;BR /&gt;&lt;BR /&gt;Can anyone suggest how I might be able to do that?&lt;BR /&gt;&lt;BR /&gt;All help is appreciated.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 09 May 2001 11:47:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526339#M24407</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2001-05-09T11:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526340#M24408</link>
      <description>Hi Nick:&lt;BR /&gt;&lt;BR /&gt;A while back I wrote a script for someone that did this, taking care of sorting dates from 'last'.  I've attached it here.  Run it with '-v' if you want verbose output.  Without that option, you get a summary of login per user.&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 09 May 2001 12:15:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526340#M24408</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-05-09T12:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526341#M24409</link>
      <description>i dont see a quick easy way, how about grep for the month, then redirect those to there own month file, then sort each one of those with a for loop by the day, and finally cat all of them to your lastlogin file.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for i in `cat monthfile`&lt;BR /&gt;do&lt;BR /&gt;&amp;lt;script&amp;gt; | grep ${i} &amp;gt;&amp;gt; ${i}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;for i in `cat monthfile`&lt;BR /&gt;do&lt;BR /&gt;sort -k 5n,5 ${i} &amp;gt; ${i}x&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;for i in `cat monthfile`&lt;BR /&gt;do&lt;BR /&gt;cat ${i}x &amp;gt;&amp;gt; lastlogin&lt;BR /&gt;rm ${i} ${i}x&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Im sure there are less painful ways of doing this but its a way.&lt;BR /&gt;&lt;BR /&gt;good luck</description>
      <pubDate>Wed, 09 May 2001 12:16:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526341#M24409</guid>
      <dc:creator>boley janowski</dc:creator>
      <dc:date>2001-05-09T12:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526342#M24410</link>
      <description>Nick,&lt;BR /&gt;&lt;BR /&gt;Like I said there are less painful ways of doing what you want, James does what you want, and you can cut out what you dont, that it reports.&lt;BR /&gt;&lt;BR /&gt;James,&lt;BR /&gt;&lt;BR /&gt;Pretty cool script, Thanks!!</description>
      <pubDate>Wed, 09 May 2001 12:24:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526342#M24410</guid>
      <dc:creator>boley janowski</dc:creator>
      <dc:date>2001-05-09T12:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526343#M24411</link>
      <description>Gents,&lt;BR /&gt;&lt;BR /&gt;Thank you but, it still does not sort in either direction, either oldest to newest or newest to oldest.  In fact, if you don't mind me saying so, my script is actually a little cleaner in the output.  For example, here is a sample:&lt;BR /&gt;root     ftp          Wed May  2 12:46 - 12:47  (00:01)&lt;BR /&gt;cherubin ttyp1        Tue May  8 15:48 - 16:14  (00:26)&lt;BR /&gt;admin    ttypd        Mon Mar 12 15:15 - 15:22  (00:06)&lt;BR /&gt;lpiscate ttyp9        Thu Mar 22 10:28 - 12:51  (02:23)&lt;BR /&gt;archer   ttyp6        Tue May  8 17:07 - 17:52  (00:45)&lt;BR /&gt;stephens pty/ttys3    Tue May  8 11:44 - 13:16  (01:32)&lt;BR /&gt;barthele ttyq7        Tue May  8 08:36 - 16:48  (08:11)&lt;BR /&gt;toigo    ttyr6        Tue May  8 08:43 - 17:37  (08:53)&lt;BR /&gt;petrecca ttyq2        Tue May  8 13:35 - 15:45  (02:10)&lt;BR /&gt;&lt;BR /&gt;Thanks, I will keep looking.</description>
      <pubDate>Thu, 10 May 2001 10:39:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526343#M24411</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2001-05-10T10:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526344#M24412</link>
      <description>Hi Nick:&lt;BR /&gt;&lt;BR /&gt;If you run the '-v(erbose)' variation of the first script I offered, you would see that the sort order is ascending last login (oldest date and time to most recent date and time) within user as ordered in /etc/passwd.&lt;BR /&gt;&lt;BR /&gt;In any event, if all that you want is one line per user, from most recent date and time of login to the oldest, with an ascending user (account) bias, then try the attached script.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 10 May 2001 13:29:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526344#M24412</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-05-10T13:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526345#M24413</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;Hmm, I am not sure about this now.  Where do I put the -v (verbose)?&lt;BR /&gt;&lt;BR /&gt;In the last or in the sort?&lt;BR /&gt;&lt;BR /&gt;Nickd</description>
      <pubDate>Thu, 10 May 2001 13:46:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526345#M24413</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2001-05-10T13:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526346#M24414</link>
      <description>Hi Nick:&lt;BR /&gt;&lt;BR /&gt;In my first attachment, you could run the script with or without the '-v' option as:&lt;BR /&gt;&lt;BR /&gt;# /tmp/jrf_last &lt;BR /&gt;# /tmp/jrf_last -v&lt;BR /&gt;&lt;BR /&gt;Simply run the second script in the second attachment as:&lt;BR /&gt;&lt;BR /&gt;# /tmp/jrf_lastuser&lt;BR /&gt;&lt;BR /&gt;This last script, I believe, is very close to that which you are looking.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 10 May 2001 13:59:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526346#M24414</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-05-10T13:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526347#M24415</link>
      <description>the combinations of for loops i initially suggested uses your script hence "&amp;lt;script&amp;gt;" i just went through and ran based on a file with the months in it, you can modify that all you want to get them in the order you want, however when i ran the other script that was suggested i got what i thought you were looking for, but if not you can take the output from that and run it through the for loops that i had suggested previously, just modify the search file as you see fit to serve your need.</description>
      <pubDate>Thu, 10 May 2001 16:53:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526347#M24415</guid>
      <dc:creator>boley janowski</dc:creator>
      <dc:date>2001-05-10T16:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526348#M24416</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;Close, but not yet.  Am I missing something?&lt;BR /&gt;This is the script that I am using.&lt;BR /&gt;Unfortunately, it does not sort by date, which is what I was looking for.&lt;BR /&gt;&lt;BR /&gt;Should I use runacct instead?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;#&lt;BR /&gt;LOG=/tmp/last.log&lt;BR /&gt;IFS=:&lt;BR /&gt;#&lt;BR /&gt;rm -f $LOG&lt;BR /&gt;#&lt;BR /&gt;while read USER NULL&lt;BR /&gt;do&lt;BR /&gt;  last -1 $USER | awk 'NF &amp;gt; 6 {print $0}' &amp;gt;&amp;gt; $LOG&lt;BR /&gt;done &amp;lt; /etc/passwd&lt;BR /&gt;#&lt;BR /&gt;sort -o $LOG -Mrk4 -krn5 -krn6.1,6.2 -krn6.4 -kb1 $LOG&lt;BR /&gt;#&lt;BR /&gt;#.jrf.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 May 2001 11:34:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526348#M24416</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2001-05-14T11:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526349#M24417</link>
      <description>Hi Nick:&lt;BR /&gt;&lt;BR /&gt;OK, you have me confused.  The script I gave you *does* sort by date.  The output is in descending date order (i.e. most recent date, first) with *one* entry (if available) from the /var/adm/wtmp file for every user defined in /etc/passwd.&lt;BR /&gt;&lt;BR /&gt;What do you want?&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 14 May 2001 11:43:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526349#M24417</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-05-14T11:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526350#M24418</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;You are absolutely right.&lt;BR /&gt;&lt;BR /&gt;The script is perfect for me.  I must have been running the wrong version or something.&lt;BR /&gt;&lt;BR /&gt;Thanks and don't mind my pointy headedness.&lt;BR /&gt;&lt;BR /&gt;&amp;lt;:-)&lt;BR /&gt;&lt;BR /&gt;Nickd</description>
      <pubDate>Tue, 15 May 2001 13:46:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526350#M24418</guid>
      <dc:creator>Nick D'Angelo</dc:creator>
      <dc:date>2001-05-15T13:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: last login script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526351#M24419</link>
      <description>Hi Nick:&lt;BR /&gt;&lt;BR /&gt;No problem; I've certainly been there too...just glad to have been of help.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 15 May 2001 13:55:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-login-script-help/m-p/2526351#M24419</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-05-15T13:55:00Z</dc:date>
    </item>
  </channel>
</rss>

