I have set up auto login on a machine and modified .bashrc
so that a script runs automatically (e.g. mplayer
playing a music stream).
Now I log in using ssh
and screen
. Command w
shows the ttys used by the autologin and the current one from the ssh screen session.
09:58:43 up 18 min, 2 users, load average: 0.11, 0.16, 0.09
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
mi tty1 09:40 18:17 30.93s 1.22s mplayer http://144.76.106.52:7000/progressive.mp3
mi pts/1 nbg021:S.0 09:55 1.00s 0.27s 0.02s w
How is it possible to switch back and forth to that autologin tty1
from within the pts/1
? I have tried chvt
, ttylog
etc.. non were successful. Any ideas?
UPDATE:
thanks for the answers. Here is the complete solution for reference. Put the following in the .bashrc
if [ $(tty) == /dev/tty1 ]; then
screen -S autologin_session -d -m mplayer http://144.76.106.52:7000/progressive.mp3
fi
then you can attach to it locally or directly over ssh
.
tty1
is a virtual console only accessible from the system console. If you want to be able to access the running program from any terminal then you should run it within screen
instead.