neko
2024-06-06 20:38 deepin
Ecological co-builder
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 Like 0 View the author
linux qq如果关机前不退出,就会提示"ensure a clean shut down"并严重延长关机时间。怎样编写一个脚本,实现在关机时同时先自动把qq退出掉?