Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

adding history logging "automagically" :)



Hi all,
   We have two user accounts which groups use for a few diff purposes, and to ease our debugging of what went wrong when things crash with our tools, we want a nice easy way to find out what was last done on the system (as opposed to the user not having any idea what the previous user did).  So essentially, these two user accounts (who already use 'zsh') will always log to a file that not everyone has to know about (just the support teams).   This doesn't take into account users who switch shells, etc, but this will give us info for about 90% of our problems.

So in a nutshell, all I want to do is modify 'zsh' source to always do the following options automatically (regardless of if these lines are present or not):

HISTSIZE=1000
SAVEHIST=1000
HISTFILE=/opt/some_location/.user.log
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt INC_APPEND_HISTORY

I've played around with hist.c & init.c with various functions and couldn't quite get this behaviour, so I was hoping for a few pointers from anyone?   I've looked at 'init_misc' in init.c and tried simple things like:

    dosetopt(SHAREHISTORY, 1, 1);
    dosetopt(INCAPPENDHISTORY, 1, 1);

and in 'hist.c', I've used

char *new_hf = "/opt/some_location/.user.log"
setsparam("HISTFILE", ztrdup(new_hf));

in a few different places, but didn't seem to do the trick.  At this point, i get a ".user.log.LOCK" file created in the proper place, but nothing gets written to ".user.log" even after the shell is exitted.

Any suggestions/info/comments would be greatly appreciated.

Thanks,
Joe.




Messages sorted by: Reverse Date, Date, Thread, Author