关机时间超长,检查后认为是wine问题,希望一种方法在关机时把wine杀掉,
照网上写service,没用
[Unit]
Description=Stop wine applications
[Service]
Type=oneshot
RemainAfterExit=true
ExecStop=/usr/bin/wineserver -k
[Install]
WantedBy=graphical.target
关机时间超长,检查后认为是wine问题,希望一种方法在关机时把wine杀掉,
照网上写service,没用
[Unit]
Description=Stop wine applications
[Service]
Type=oneshot
RemainAfterExit=true
ExecStop=/usr/bin/wineserver -k
[Install]
WantedBy=graphical.target
试试 -k 后面加上 9,这样送出的信号是 SIGKILL
当然更简单的方式是 pkill -9 wine
不知为何,wineserver -k后进程列表wine消失,但重启还是要等kill wine进程
换成pkill就不用等
不过问题倒是解决了
分享一下我的。用 shutdown.target 似乎语义上更健壮一些:
[Unit]
Description=Kill wine processes at shutdown
# A service will set Conflicts=shutdown.target by default. Disable it.
DefaultDependencies=false
Before=shutdown.target umount.target
[Service]
# A service that isn't part of system.slice will not be started during shutdown.
Slice=system.slice
ExecStart=/bin/pkill --ignore-ancestors "wineserver|winedevice.exe"
# Wait a while to let them exit gracefully
ExecStart=/bin/sleep 3
# Force kill if still running
ExecStart=/bin/pkill --signal KILL --ignore-ancestors "wineserver|winedevice.exe"
Type=oneshot
# Even if pkill fails (no wineserver running), we still want to continue shutdown.
SuccessExitStatus=FAILURE
[Install]
WantedBy=shutdown.target