Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17852

Creative .bash_history for a shared user?

$
0
0

Let's say we have a shared user (I know, I know...I have no control over this part). Several people are su'ing over to this user for the purpose of running jobs (scripts). To make matters worse this users' home directory is actually on an NFS mount that several machines share (for purposes of splitting up the load).

There are efforts underway to change some of that (perhaps hadoop etc)...but movement there is slow. The problem I'm trying to solve in the short term is the .bash_history.

The problem is that we have an automation system that's running jobs across the servers as well as a team of folks who are doing things by hand (research etc). The bash history turns into a mess. I can't do something interactive like asking for their name because it will mess with the automated jobs.

I almost considered just setting the $HISTFILE to something like HISTFILE=$HISTFILE-$(hostname) and then also setting 'shopt -s append' and then also make it so history appends after each command and not at the end of the session.

Anyone have any neckbeard-guru advice for the situation at hand?

Edit: Likely found a solution. The automation suite connects in a non-interactive way, so I can set the histfile using .bashrc/bash_profile. Since .bash_login fires off further down the line for interactive sessions I can set it differently there.

submitted by joshlove
[link][6 comments]

Viewing all articles
Browse latest Browse all 17852