to check history


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting to check history
# 1  
Old 07-21-2011
to check history

all,

i am trying a simple thing but not able to do Smilie .
i want to track history when users login in env and do anything. there is one file , .profile which get executed on every login. i added below logic in the last of file -
Code:
MYSELF=`who am i -R`
MY_TERM=`echo ${MYSELF}|awk '{print $1"."$6}'|tr -dc '[:alnum:][.]'`
MY_TTY=`echo ${MYSELF}|awk '{print $2}'|sed 's#/#.#g'`
LOG_DATE_TIME=$(date +"%d%m%Y_%H%M%S")
HDIR="${HOME}/var/lsp/projs/op/history"
mkdir -p ${HDIR}
MYHFILE="${HDIR}/${MY_TERM}.${MY_TTY}.${LOG_DATE_TIME}.$$"
touch ${MYHFILE}
HISTFILE="${MYHFILE}"

so at desired location , i see new file created but of '0' size , data is not coming in this. if i check this on another account on same server(account- xdmadm) , their i see desired data in history file.
i find same value of eecho $HISTFILE on both accounts.
IMP - file owner of .profile is xdmadm . it's a link in my account pointing to xdmadm acocunt file.
Please suggest !!!

---------- Post updated at 02:26 PM ---------- Previous update was at 12:52 PM ----------

Hi Franklin , i dint understand you.
these are the commands , if i in any file which will export these variables in env. like as i mentioned,
.profile -> pointing to xdmadm user home dir ,
and so it is fine for xdmadm user , but not for this account. but it should be

Last edited by Franklin52; 07-21-2011 at 03:59 AM.. Reason: Please use code tags for code and data samples, thank you
# 2  
Old 07-25-2011
can someone please help me !!!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. What is on Your Mind?

The Great History of UNIX (1969-1999) | 30 Years of UNIX History | YouTube Video

I am pleased to announce this new video in 1080 HD for UNIX lovers honoring thirty years of UNIX history spanning from 1969 to 1999 presented in 150 seconds (two and a half minutes) in 1080 HD, celebrating the 50th anniversary of UNIX. The Great History of UNIX (1969-1999) | 30 Years of UNIX... (8 Replies)
Discussion started by: Neo
8 Replies

2. UNIX for Dummies Questions & Answers

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (1 Reply)
Discussion started by: sriky86
1 Replies

3. Shell Programming and Scripting

Perl code to check date and check files in particular dir

Hi Experts, I am checking how to get day in Perl. If it is “Monday” I need to process…below is the pseudo code. Can you please prove the code for below condition. if (today=="Monday" ) { while (current_time LESS THAN 9:01 AM) ... (1 Reply)
Discussion started by: ajaypatil_am
1 Replies

4. UNIX for Dummies Questions & Answers

The history command: See other users command history

Can anyone tell this: If two users are logged into the same server from different locations. Is there a way to see the history command of the other user? I tried the history command, but it is showing me only the commands I used. Thanks in advance for your help. Iamnew2solaris (1 Reply)
Discussion started by: iamnew2solaris
1 Replies

5. UNIX for Advanced & Expert Users

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (3 Replies)
Discussion started by: linuxadmin
3 Replies

6. UNIX for Dummies Questions & Answers

How to review the history and the commands that has been done in this history?

Hello every body, Kindly inform me How Do i find out the time I executed a command previously on UNIX Solaris?? To be more specific and more clear about what i want to know is that I want a command the enables me to know the history and which command i run at this history/time. FYI I used... (5 Replies)
Discussion started by: ahmedamer12
5 Replies

7. UNIX for Advanced & Expert Users

Check EOF char in Unix. OR To check file has been received completely from a remote system

Advance Thanks. (1) I would like to know any unix/Linux command to check EOF char in a file. (2) Or Any way I can check a file has been reached completely at machine B from machine A. Note that machine A ftp/scp the file to machine B at unknown time. (5 Replies)
Discussion started by: alexalex1
5 Replies

8. UNIX for Dummies Questions & Answers

Script to check for a file, check for 2hrs. then quit

I wish to seach a Dir for a specific file, once the file is found i will perform additional logic. If the file is not found within two hours, i would like to exit. Logically, I'm looking for the best way to approach this Thanks for any assistance in advance. Note: I'm using a C shell and... (2 Replies)
Discussion started by: mmarsh
2 Replies
Login or Register to Ask a Question