The result of Jan 01 (1970) by last command


 
Thread Tools Search this Thread
Operating Systems AIX The result of Jan 01 (1970) by last command
# 1  
Old 12-23-2012
The result of Jan 01 (1970) by last command

Dears,
My boss asked me to record the login information on AIX server, so I used "last" command to get i want. But it is so strange when i get a record the login date is Jan,01 1970 (as attached picture). does anyone know what happen?


Thanks and Regards,
The result of Jan 01 (1970)  by last command-lastpng
# 2  
Old 12-24-2012
That is just weird! Just wondering how long the system has been up!! Smilie
Code:
uptime

I suggest to check more on that user: fstsfix it does not even have any info on terminal!
This User Gave Thanks to Yoda For This Post:
# 3  
Old 12-24-2012
Hi bipinajith,

Thanks for your reply, here is info your wanted.

Code:
$ uptime
  01:59PM   up 64 days,   7:36,  8 users,  load average: 2.23, 1.72, 1.72

BTW, i check the .sh_history of FSTSFIX and there is nothing weird in it.
Code:
cd .. #?1355908025#?
ls -l #?1355908026#?
ls #?1356050227#?
cd bin #?1356050233#?
ls #?1356050233#?
cd #?1356050237#?
fstsfix status #?1356050239#?
crontab -l #?1356050251#?
ls #?1356050316#?
cd log #?1356050318#?
ls #?1356050318#?
cd 4 #?1356050327#?
ls #?1356050328#?
cd #?1356050331#?
ls #?1356050332#?
cd bin #?1356050335#?
ls #?1356050335#?
...

And the crontab job works correctly. Please tell me if any infomation I can provide more, thks.
Code:
$ crontab -l
00 07 * * 1-5 /u/fstsfix/bin/fstsfix bod
#50 07 * * 1-5 /u/fstsfix/bin/fstsfix start
00 05 * * * /u/fstsfix/bin/fstsfix   stop
40 05 * * * /u/fstsfix/bin/fstsrvd   stop
45 05 * * * /u/fstsfix/bin/fstsfix   eod

# 4  
Old 12-24-2012
As per the AIX manual all previous logins and logoffs are recorded in the /var/adm/wtmp file. I'm not sure what exactly fstsfix is doing. So I won't be able to tell what is wrong. You have to analyze more on this executable to understand what is causing it to display this strange last login time-stamp.
# 5  
Old 12-24-2012
Yes, like you said, I checked the wtmp by following cmd. And searched .sh_history which the last cmd executed by fstsfix in 2012/12/21 is "ls -l". I still can't figure out anything, maybe I should let it go.... XD

Code:
h56s1tst:/home/fstsfix># last fstsfix -f /var/adm/wtmp -n 10 console
fstsfix   pts/7        10.81.XXX.43           Dec 24 10:26 - 14:33  (04:07)
fstsfix   pts/6        10.81.XXX.43           Dec 24 09:50   still logged in.
fstsfix   pts/4        10.81.XXX.43           Dec 22 08:20 - 17:34  (09:14)
fstsfix   ftp          10.81.XXX.54           Dec 21 18:12 - 18:22  (00:09)
fstsfix                                       Jan 01 08:00 - 08:55 (15695+00:55)
fstsfix   ftp          h5XXXtst               Dec 19 18:10 - 18:11  (00:00)
fstsfix   pts/6        10.81.XXX.54           Dec 19 17:01 - 19:19  (02:18)
fstsfix   pts/6        10.81.XXX.54           Dec 19 16:51 - 16:58  (00:06)
fstsfix   pts/7        10.81.XXX.54           Dec 17 09:40 - 11:52  (02:12)
fstsfix   ftp          10.81.XXX.54           Dec 11 19:51 - 19:51  (00:00)

Code:
cd .. #?1355908025#?
ls -l #?1355908026#?
ls #?1356050227#?

# 6  
Old 12-24-2012
You could always use lsuser for each user in turn (cut the first column from /etc/passwd) and extract the time_last_login value from that.

It is time in seconds since the epoch, so convert that to real time. If the value is zero (i.e. never logged on) you will generate the date/time 1/1/1970 00:00.

The conversion I use (that I found on here) is:-
Code:
perl -e 'print scalar localtime $ARGV[0],"\n" ' $1

I pass in the large number of seconds as a parameter, so if you call it realtime you get the following:-
Code:
RBATTE1> ./realtime  1234567890
Fri Feb 13 23:31:30 2009
RBATTE1>


I hope that this helps.


Robin
Liverpool/Blackburn
UK
These 2 Users Gave Thanks to rbatte1 For This Post:
# 7  
Old 12-24-2012
Thank you, Robin. I tried the command "lsuser fstsfix", but it is too late that the time_last_login has been overwrote.
Code:
/># lsuser fstsfix
fstsfix id=414 pgrp=fsts groups=fsts,usms home=/u/fstsfix shell=/usr/bin/ksh login=true su=true rlogin=true 
daemon=true admin=false sugroups=ALL admgroups= tpath=nosak ttys=ALL expires=0 auth1=SYSTEM auth2
=NONE umask=22 registry=files SYSTEM=( compat ) logintimes= loginretries=0 pwdwarntime=0 account_locked
=false minage=0 maxage=0 maxexpired=-1 minalpha=0 minother=0 mindiff=0 maxrepeats=0 minlen=0 
histexpire=0 histsize=0 pwdchecks= dictionlist= fsize=2097151 cpu=-1 data=262144 stack=65536 core=2097151 
rss=65536 nofiles=2000 time_last_login=1356316007 time_last_unsuccessful_login=1356398305 
tty_last_login=/dev/pts/7 tty_last_unsuccessful_login=/dev/pts/4 host_last_login=10.81.XXX.43 
host_last_unsuccessful_login=10.81.XXX.43 unsuccessful_login_count=1 roles=

BTW, about the perl converting the real time, it is awesome!! Because I converted it by EXCEL (X+8*3600)/86400+70*365+19 lately.
Code:
/># ./realtime 1356316007
Mon Dec 24 10:26:47 2012

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux find command seems to not transmit all the result to the '-exec command'

Hello. From a script, a command for a test is use : find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc' Tha command... (3 Replies)
Discussion started by: jcdole
3 Replies

2. Shell Programming and Scripting

Grep command giving different result for different users for same command

Hello, I am running below command as root user #nodetool cfstats tests | grep "Memtable switch count" Memtable switch count: 12 Where as when I try to run same command as another user it gives different result. #su -l zabbix -s /bin/bash -c "nodetool cfstats tests | grep "Memtable switch... (10 Replies)
Discussion started by: Pushpraj
10 Replies

3. Shell Programming and Scripting

Grep result from dd command

Hi, I am running following command in a bash script for testing IO and use grep to get throughput number, but it did not work, it displayed everything: dd if=/dev/zero of=/dev/null bs=1G count=1 oflag=dsync | grep bytes | awk '{print $7}' 1+0 records in 1+0 records out 536870912 bytes... (2 Replies)
Discussion started by: hce
2 Replies

4. Shell Programming and Scripting

Write Linux script to convert timestamps older than 1.1.1970 to 1.1.1980

I am having problems because some of my files have timestamps that are earlier that 1.1.1970, the Unix start of time convention. So I would like to write a script that finds all files in home folder and subfolders with timestamps earlier than 1.1.1970 and converts them to 1.1.1980. I... (3 Replies)
Discussion started by: francus
3 Replies

5. Shell Programming and Scripting

How do i compare two dates with format Jan 01, 2012 and Jan 00 2012

I need to be able to compare dates in the format of Jan 10, 2012 and Jan 10 2012. (Notice one has a comma). Then I need to find the date that is 7 days before those dates if they are equal. How can I do this in Bash. Thank ahead (4 Replies)
Discussion started by: ojthejuice
4 Replies

6. Shell Programming and Scripting

How to use the result from a command in SED

Hi all, this is my first post so go gentle. My goal is to use SED to add data to the end of lines in a file, then send the results to standard output. However, I want to add the result of another command to the end of the lines. Basically: sed 's/$/ insert command stuff here/' file.txtHere... (1 Reply)
Discussion started by: jsmith_4242
1 Replies

7. UNIX for Dummies Questions & Answers

Capturing a non-result of a command

The following pseudo-code should be clear to what I am trying to achieve: if ; then kldload linux echo 'linux_enable="YES"' >> /etc/rc.conf fi What is the proper syntax or operator for the test? Thanks in advance (5 Replies)
Discussion started by: figaro
5 Replies

8. UNIX for Dummies Questions & Answers

Date to second since 1970

Hello, I have found a piece of code which converts seconds elapsed since 1970 for an input date. Can anyone please explain a little bit the code below: #!/bin/bash # function to reproduce UNIX time() value second() { set -- $(TZ=GMT date '+%Y %m %d') local y=$1 m=1$2 d=1$3 ((m-=103,... (0 Replies)
Discussion started by: thana
0 Replies

9. IP Networking

FTP command result

Hi there! I've used the ftp command to transfert datas between two linux box. The answer of this command, was: It strange because the transfert was complete and it brings two messages, the first is successful from PORT command and the second is an error from EPRT command! So, It seems that... (1 Reply)
Discussion started by: nymus7
1 Replies

10. UNIX for Dummies Questions & Answers

days since 1970

How can I get the syatem to give me the days since 1970 (as seen in the shadow file)? (4 Replies)
Discussion started by: 98_1LE
4 Replies
Login or Register to Ask a Question