linux - 在唤醒时执行 bash 脚本
问题描述
一段时间以来,我的 Linux 发行版(Kubuntu 18.04)有一个 Prolbem。每次我的 linux 从待机模式返回时,触摸板都无法正常工作(无法抓取和拖动文件或其他对象)。
我已经为我的问题找到了解决方案:
modprobe psmouse -r
modprobe psmouse
这段代码确实解决了这个问题。但是,在此之后,我总是在 sartup 禁用的右键单击区域再次启用。我有一个在启动时运行的脚本,它执行以下操作:
synclient RightButtonAreaLeft=0
synclient RightButtonAreaTop=0
我现在要做的是编写一个脚本,该脚本在系统从待机模式唤醒时运行。我写了这样的脚本:
#!/bin/bash
exec 1> /home/luc/Schreibtisch/update.log 2>&1
set -x
case $1/$2 in
pre/*)
echo "Going to $2..."
# Place your pre suspend commands here, or `exit 0`
# if no pre suspend action required
exit 0
;;
post/*)
echo "Waking up from $2..."
sh /home/luc/Schreibtisch/test.sh
sh /home/luc/Schreibtisch/test2.sh
;;
esac
其中 test.sh 运行modprobe
命令,而 test2.sh 运行synclient
命令。
进入待机模式并再次醒来后,我收到以下日志:
+ case $1/$2 in
+ echo 'Waking up from suspend...'
Waking up from suspend...
+ sh /home/luc/Schreibtisch/test.sh
+ sh /home/luc/Schreibtisch/test2.sh
Failed to connect to X Server.
Failed to connect to X Server.
并且文件的抓取和拖动工作完美,但仍然启用右键单击。
我现在的问题是,是否可以synclient
在 X 服务器准备就绪后执行命令?
亲切的问候百事隆
解决方案
看来我找到了解决唤醒后触摸板无法正常工作的问题的解决方法。
在我/etc/modprobe.d/blacklist.conf
的模块i2c_i801
中被列入黑名单。从黑名单中删除此模块后,我的触摸板现在在待机模式后可以正常工作。
推荐阅读
- javascript - 在本机反应中强制捕捉尝试错误响应?
- google-apps-script - 记录访问 Google 电子表格的用户
- java - 必需的请求部分
- python - 大熊猫沉默失败,枢轴()
- azure-active-directory - React / PyFlask - 正确的 Microsoft AD 登录架构
- xml - 使用 XSL/xsltproc 自动修改 LotusConnections-config.xml:没有任何东西被错误的命名空间替换
- angular-material - 如何将多列添加到角度 mat-list
- neo4j - 依靠 Neo4j Cypher 中的特定属性
- angular - 在 Angular 中克隆 html 内容
- php - 通过 MSGraph PHP SDK 生成回复邮件