在 tty1 上运行脚本,但在 tty6 登录

在 tty1 上运行脚本,但在 tty6 登录

我创建了一个在 tty1 上运行脚本的实时 CD。我将脚本放在 /etc/profile.d 中,以便它在启动时运行。但这样脚本也会在其他 tty 上启动。我创建了一个脚本,如果用户中止或按下 ctrl-c,机器将重新启动,因此他们无法访问 shell。

我想启用 tty6 登录以进行调试。我该怎么做?

谢谢

答案1

/etc/profile.d/每次有人登录时都会执行中的脚本。将需要在系统启动期间执行的脚本放在错误的位置可能不太好。您最好编写一个启动/停止脚本,或者将脚本放入/etc/rc.local

user@host:~# cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0

相关内容