On Mon, Apr 21, 2014 at 4:51 PM, Alessandro DE LAURENZIS <
[email protected]> wrote:
> Hello,
>
> I google-ed a lot, but it seems that there is no trivial solution to
> this point.
>
> I extensively use console (and tmux), ending up with a lot of
> simultaneously open shells; I normally suspend my laptop when I leave,
> so it would be a security enhancement to automatically lock all of them.
>
How about using lock(1) ?
>
> Trying to follow the same approach I use to lauch xlock for the X
> session, I run the following script from my .kshrc:
>
> just22@poseidon:[~]> cat ./bin/console-lock
> #!/bin/sh
>
> # Lock console when SIGUSR1 is received
> trap '/usr/bin/lock -np' USR1
>
> # Daemonize...
> while /usr/bin/true; do
> sleep 1
> done
>
>
> just22@poseidon:[~]> egrep -A1 -B3 console-lock /home/just22/.kshrc
> # In console, activate colour support and auto-lock
> if [ "${TERM}" == "vt220" ]; then
> export TERM=wsvt25
> ${HOME}/bin/console-lock &
> fi
>
>
> Now, when I send a USR1 signal to all the open console-lock processes
> (manually or by means of /etc/apm/suspend):
>
> just22@poseidon:[~]> pkill -USR1 -f ".*console-lock"
>
> the lock command is correctly spawn in each console, but since the
> parent process is in background, it is in background, too (resulting
> useless, of course).
>
> How could I improve the idea?
>
> Of course, any suitable alternatives would be welcome.
>
> Thanks in advance
>
> --
> Alessandro DE LAURENZIS
> [mailto:[email protected]]
> LinkedIn: http://it.linkedin.com/in/delaurenzis