1、运行普通脚本
在 /etc/init.d目录下创建一个脚本 xxx.sh
chmod +x xxx.sh
添加自动启动
sudo update-rc.d xxx.sh defaults
删除自动启动
sudo update-rc.d xxx.sh remove
如果还要按照start stop启动。需要在xxx.sh里面编辑脚本 添加对应的start stop操作。
2、运行xset命令
我的鼠标由于没有linux驱动 所以无法调整指针速度。每次都要靠xset m default来调整
由于开始的时候桌面服务还没有起来所以不能用普通的rc.d启动
又由于桌面交互服务起来的时候可能会重置这个值。所以要在合适的时候运行 xset m 1指令
这个根据你的使用桌面环境不同添加的也不同。
我用的是unity桌面。启动是lightdm(kde gnome 地方都不同。)
在14.04之前是这个文件
etc/lightdm/lightdm.conf
14.04以后是
/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
具体的运行时机根据你的需要来定制,参看https://wiki.ubuntu.com/LightDM
display-setup-script=command
display-stopped-script=command (Not in Ubuntu 12.04 LTS)
greeter-setup-script=command
session-setup-script=command
session-cleanup-script=command
session-wrapper=command
greeter-wrapper=command (Not in Ubuntu 12.04 LTS)
我要在用户回话开始以后再执行.所以是session-wrapper=command
command就是脚本或者命令的名字。我这里用脚本
我的是16.04
所以编辑50-ubuntu.conf 添加一行session-wrapper=/usr/bin/setmouse.sh
[Seat:*]
user-session=ubuntu
session-wrapper=/usr/bin/setmouse.sh
然后在/usr/bin/s创建 setmouse.sh
里面写入xet m 1
chmod +x setmouse.sh
重启就好了。