PlayOnLinux runs Wine in separate virtual drives, so it's normal that a plain "wineserver -k" doesn't see anything running: it's not in the right context.
At very least $PREFIX must be set to the path of the "prefix" of the virtual drive (/home/user/.PlayOnLinux/wineprefix/Name), but I suspect "wineprefix" command has to come from the right Wine version too, so you may have to set $PATH and $LD_LIBRARY_PATH so it works...
I wrote the playonlinux-base script below to kill the wineserver of the virtual drive passed as argument:
polkillall:
#!/usr/bin/env playonlinux-bash
[ "$PLAYONLINUX" ] || exit 0
source "$PLAYONLINUX/lib/sources"
usage () {
local self="$(basename "$0")"
(echo "Usage: $self <Virtual drive name>"
echo "Kill the wineserver running this virtual drive"
echo ""
echo "Virtual drives:"
cd $HOME/.PlayOnLinux/wineprefix && \
for i in *; do
[ -d "$i" -a "$i" != "default" ] && echo " $i"
done) >&2
exit 0
}
[ "$1" ] || usage
POL_Wine_SelectPrefix "$1"
POL_Wine_AutoSetVersionEnv
wineserver -k
The problem is that it requires an X display, so if your X server is not totally dead (just unreachable), maybe using
export DISPLAY=:0
in terminal will be enough for this script to work, I can't really tell...
Not requiring an X display will be difficult...