温馨提示×

Ubuntu Trigger怎么禁用

小樊
47
2026-07-10 17:28:11
栏目: 智能运维

在 Ubuntu 里没有叫 “Ubuntu Trigger” 的官方标准组件,所以“禁用”要分情况。下面把最常见的几种可能都列出来,你对照一下是哪一种。


一、如果你指的是 触发器 / 定时任务(Trigger)

1️⃣ systemd timer(最常见)

很多“trigger”其实是 systemd timer

查看所有 timer:

systemctl list-timers --all

禁用某个 timer(例如 apt-daily.timer):

sudo systemctl disable --now apt-daily.timer
sudo systemctl disable --now apt-daily-upgrade.timer

彻底屏蔽(防止被其他服务唤醒):

sudo systemctl mask apt-daily.timer

2️⃣ cron / anacron 定时任务

查看 cron:

crontab -l
sudo crontab -l

编辑:

crontab -e
sudo crontab -e

删除或注释掉对应的 trigger 行即可。


二、如果你指的是 Ubuntu 自动更新触发器

Ubuntu 的自动更新由以下服务控制:

sudo systemctl disable --now apt-daily.timer
sudo systemctl disable --now apt-daily-upgrade.timer

或彻底关闭自动更新:

sudo apt remove unattended-upgrades

三、如果你指的是 GNOME / 桌面触发器(如电源、唤醒、锁屏)

GNOME 设置里:

gnome-control-center
  • 电源 → 关闭自动挂起
  • 隐私 → 关闭自动锁屏

命令行示例:

gsettings set org.gnome.desktop.screensaver lock-enabled false

四、如果你指的是 某个具体软件叫 “Trigger”

例如:

  • Triggerhappy(输入设备触发器)
  • 自定义脚本 / 监听事件

禁用 Triggerhappy

sudo systemctl disable --now triggerhappy.service

五、如果你不确定是什么 Trigger(推荐做法)

请执行:

systemctl list-units --type=trigger --all

grep -R "trigger" /etc/systemd /etc/cron* ~/.config/systemd

然后把输出或截图发给我,我可以直接告诉你精确禁用命令


✅ 总结一句话

Ubuntu 没有统一的 “Ubuntu Trigger”,通常是 systemd timer、cron、自动更新或某个服务
找到具体名字后,用 systemctl disable --now xxx.timer 即可禁用。

如果你能告诉我:

  • 是在 服务器还是桌面
  • 在哪个界面 / 日志里看到 “Trigger”
  • 或贴一段报错 / 截图

我可以给你一步到位的命令

0