[Experience sharing] acer电脑关机自动重启
Tofloor
poster avatar
deepin-流云
Moderator
2025-03-10 16:09
Author

应用场景

硬件/整机信息:宏碁acer电脑

OS版本信息:桌面专业版、家庭版

问题现象

acer电脑关机自动重启

解决方案

步骤一

写个脚本

sudo vi /usr/local/bin/haltusbpower.sh

文件中添加下列内容:

#!/bin/bash

for i in /sys/bus/usb/devices/\*/power/control;

do

echo on > \$i

done

步骤二

添加文件的执行权限

chmod +x /usr/local/bin/haltusbpower.sh

步骤三

sudo vi /usr/lib/systemd/system/haltusbpower.service

添加内容:

[Unit]

Description=haltusbpower

Before=shutdown.target

DefaultDependencies=no

[Service]

ExecStart=/usr/local/bin/haltusbpower.sh

Type=oneshot

RemainAfterExit=yes

[Install]

WantedBy=shutdown.target

步骤四

开启服务

systemctl enable haltusbpower.service
Reply Favorite View the author
All Replies

No replies yet

New Thread

Popular Ranking

Change

Popular Events

More
国际排名
WHLUG