Eseguire un comando su una console fisica di un host linux

From RVM Wiki
Jump to navigation Jump to search
  • Se ad esempio si vuole visulizzare un iftop sulla console fisica tty2 ed uno su tty3, accessibili con ALT-F2 ed ALT-F3, impostare il programma da eseguire in:
sudoedit /etc/inittab
1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
2:23:respawn:/usr/sbin/iftop -i eth0 -c /root/.iftoprc  </dev/tty2 >/dev/tty2 2>&1
#3:23:respawn:/sbin/getty 38400 tty3
3:23:respawn:/usr/sbin/iftop -i eth1 -c /root/.iftoprc </dev/tty3 >/dev/tty3 2>&1
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
  • Far rileggere initttab
init q
telinit q
  • Killare i precedenti processi getty che occupano la console:
ps auxw | grep tty2
root        6456  0.0  0.0  16224   952 tty1     Ss+  16:26   0:00 /sbin/getty 38400 tty2
kill 6456
ps auxw | grep tty2
root        6457  0.0  0.0  16224   952 tty1     Ss+  16:26   0:00 /sbin/getty 38400 tty3
kill 6457
  • Switchare sulla console per controllare con ALT-Fx o cambaire da remoto con
chvt 2
chvt3

Riferimenti