我的笔记本电脑上运行着 ubuntu 14.04。我有一个脚本来/etc/init.d
禁用它:
#!/bin/bash
# Get the device id of the Synaptics TouchPad
id=$(xinput list --id-only 'AT Translated Set 2 keyboard')
xinput float $id
它运行正常,但我需要它在登录屏幕出现之前运行,所以我做了:
ln -s /etc/init.d/disableKeyboard.sh /etc/rc3.d/S99disableKeyboard.sh
但它不起作用,有人知道为什么它在启动时没有运行吗?
谢谢。
答案1
要在启动时运行脚本,请在登录前编辑/etc/rc.local
并添加命令。
只需添加这一行:
/etc/init.d/disableKeyboard.sh
行上方一行:
exit 0
# 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.
答案2
为了在登录屏幕之前运行脚本/命令,您必须编辑
/etc/rc.local
并在其末尾添加命令。确保以以下内容结束脚本exit 0
所以,就你的情况来说
/etc/init.d/disableKeyboard.sh
将被添加到/etc/rc.local
和
exit 0
将添加到/etc/init.d/disableKeyboard.sh