Secondary Login

Hi

In Linux I set Secondary Logging in the way below.

1. We perform this by adding below lines into 
/root/.bashrcfile :

# secondary logging beginexport HISTSIZE=600000export HISTFILESIZE=600000export HISTTIMEFORMAT="%F %T %z "export HISTFILE=/root/.bashhist/root_history-$(who am i | awk '{print $1}';exit)export PROMPT_COMMAND='history -a'# secondary logging end

2. Create dir 

mkdir /root/.bashhist

---------- Post updated at 09:06 PM ---------- Previous update was at 09:03 PM ----------

In hp-ux I wanted the same to achieve but /usr/bin/sh doesn't have variable HISTTIMEFORMAT.

How to add timestamp to log file in HP_UX ??

Include a unique username, timestamp and terminal id (tty) combination in $HISTFILE . This gives you a separate History File for every session.
There is no facility in HP-UX Posix Shell to timestamp every line in the command history.

Since I dont have a linux nor bash to play with let me ask you what does the output look like? (to see what we can do to get the most approaching result...).
Do these extra addition (I suppose so) get filtered by the history when you use history facility (like recall of some previous commands...)? ( will be far more difficult if not impossible in HP-UX...).
methyl suggestion is the best you could do if keeping things simple... I add extra information but I dont leave them in .sh_history ( as stated above..) except one line in my account (to test how pervert it could be for side effects...) which add the login time at each connection: At the end of my .profile I have:

print -s "LOGIN - `date '+%m-%d-%E-%H:%M'`"

More preciselly I described it here.
Secondary Logging -> usage of shared account (root)

It based on linux in my example.

On my favorite box I have in root's .profile:

# Set up shell variables:
        SUFF=`who am i -R| awk -F " " '{print $1"."$NF}'`
        export HISTFILE=/home/root/.sh_history.$SUFF
        MAIL=/var/mail/root
        # don't export, so only login shell checks.
        print -s "LOGIN - `date '+%m-%d-%E-%H:%M'`"
        echo "WARNING:  YOU ARE SUPERUSER !!\n"