From: Glynn Clements Subject: Re: Starting "Script" when user logs on. Date: Thu, 4 Aug 2005 12:11:56 +0100 Message-ID: <17137.63484.676896.844904@cerise.gclements.plus.com> References: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-admin-owner@vger.kernel.org List-Id: Content-Type: text/plain; charset="us-ascii" To: Md Shanto Cc: linux-admin@vger.kernel.org Md Shanto wrote: > Initially I tired with "ttyrec" a tty recorder and failed, as it says > "Out of pty's - Terminated". Unless these processes aren't being cleaned up (in which case, you will probably have over a hundred stale ttyrec processes), it may be that ttyrec was compiled for BSD-style ptys but your system is using Unix98 ptys (or vice-versa). > Now, I tried something like below: > > ------------------ > #!/bin/bash -l > USER=`whoami` > LOGTIME=`date +%Y-%m-%d-%H:%M:%S` > /usr/bin/script -q /var/log/commlog/$USER-$LOGTIME > ------------------ Apart from anything else, you should probably use "exec" for the last statement, i.e.: exec /usr/bin/script -q /var/log/commlog/$USER-$LOGTIME This causes the "script" process to replace the bash process running the shell script, rather than leaving the bash process hanging around until script exits.