Re: Starting "Script" when user logs on.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux