[Topic DIscussion] qq关机自动退出脚本
Tofloor
poster avatar
zz
deepin
2024-06-06 20:21
Author

linux qq如果关机前不退出,就会提示"ensure a clean shut down"并严重延长关机时间。怎样编写一个脚本,实现在关机时同时先自动把qq退出掉?

Reply Favorite View the author
All Replies
neko
deepin
Ecological co-builder
2024-06-06 20:38
#1
cat << EOF | tee ~/.config/systemd/user/kill-qq.service
[Unit]
Description=Run a custom script at shutdown
DefaultDependencies=no
Before=shutdown.target

[Service]
Type=oneshot
ExecStart=pkill qq
RemainAfterExit=true

[Install]
WantedBy=halt.target poweroff.target reboot.target
EOF

粘贴到终端执行会创建一个用户级服务,在关机的时候杀死qq进程。

systemctl --user daemon-reload #重载服务使其生效

但依然要在关机界面手动点一下关机

Reply View the author
zz
deepin
2024-06-06 22:23
#2
neko
cat << EOF | tee ~/.config/systemd/user/kill-qq.service
[Unit]
Description=Run a custom script at shutdown
DefaultDependencies=no
Before=shutdown.target

[Service]
Type=oneshot
ExecStart=pkill qq
RemainAfterExit=true

[Install]
WantedBy=halt.target poweroff.target reboot.target
EOF

粘贴到终端执行会创建一个用户级服务,在关机的时候杀死qq进程。

systemctl --user daemon-reload #重载服务使其生效

但依然要在关机界面手动点一下关机

就是这个服务安装好后,虽然依然有ensure a clean shut down要确认关机 但实际不会卡死了对吧🤔🤔

Reply View the author
neko
deepin
Ecological co-builder
2024-06-06 23:13
#3
zz

就是这个服务安装好后,虽然依然有ensure a clean shut down要确认关机 但实际不会卡死了对吧🤔🤔

理论上是这样

Reply View the author