- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to time stamp history file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2006 05:57 AM
04-04-2006 05:57 AM
How to time stamp history file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2006 06:09 AM
04-04-2006 06:09 AM
Re: How to time stamp history file
Maybe something like Rick Garland recommended?
HST=`hostname`
USR=`who -um | awk '{print $1}'`
NAME=`whoami`# Set History File
HISTFILE=/home/root/.sh_history_"${HST}"_"${USR}"-as-"${NAME}"_`date +%y%m%d.%
H%M%S_$$`
export HISTFILE
I can't claim to be the clever person behind this, but I found the reference in this itrc thread: http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=901609&admit=-682735245+1144174017758+28353475
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2006 07:51 AM
04-04-2006 07:51 AM
Re: How to time stamp history file
That was going to be my suggestion.
What is happening is that a new history file is created with each login session. Each of these files is time/date stamped. Since you can't get the stamps in the file for each line item, you can place a timeon the additions to the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2006 07:54 AM
04-04-2006 07:54 AM
Re: How to time stamp history file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2006 08:33 AM
04-04-2006 08:33 AM
Re: How to time stamp history file
echo `date` >> $HIST
This will insert the date into the history file as defined by $HIST. However this is a manual process.
To automate, something in the profile might do the trick (this is a guess, not an answer)
while true
do
echo `date` >> $HIST
sleep 300
done
This little while loop will append/echo the `date` output every 5 minutes to the $HIST file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2006 08:49 AM
04-04-2006 08:49 AM
Re: How to time stamp history file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 02:33 AM
04-05-2006 02:33 AM
Re: How to time stamp history file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 03:36 AM
04-05-2006 03:36 AM
Re: How to time stamp history file
HISTTIMEFORMAT="%D %T "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 04:48 AM
04-05-2006 04:48 AM
Re: How to time stamp history file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 07:38 AM
04-05-2006 07:38 AM
Re: How to time stamp history file
PS1='$(printf "%(# %D %T )T" | read -s)$ '
This prompt setting will put the current date and time into the history each time ksh comes back to printing a prompt. The timestamp will appear as a separate line. It will show the time that the preceeding command completed. You won't be able to know exactly when a long-running command was started. (The bash timestamp feature shows the start times of entered commands and doesn't show when they finish.)