38 lines
992 B
Bash
Executable File
38 lines
992 B
Bash
Executable File
#!/bin/bash
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:$PATH
|
|
|
|
TIMEOUT=8 # wait timeout for X server start
|
|
|
|
LOCK_FILE=/tmp/.snail.lock
|
|
FIFO_FILE=/tmp/.snail.fifo
|
|
|
|
[ ! -f $LOCK_FILE ] && echo "Snail daemon is not running. Please start it." && exit -1
|
|
|
|
{
|
|
flock -w 1 -s 9
|
|
if [ 0 -ne $? ]; then
|
|
(nohup echo -n > $FIFO_FILE &>/dev/null)&
|
|
flock -w $TIMEOUT -s 9
|
|
fi
|
|
|
|
if [ 0 -eq $? ]; then
|
|
echo "Trying to run $@ on nVidia"
|
|
export LD_LIBRARY_PATH=/usr/lib/snail
|
|
LD_PRELOAD="/usr/lib/snail/lib32/libGL.so.1 \
|
|
/usr/lib/snail/lib32/libnvidia-tls.so \
|
|
/usr/lib/snail/lib32/libnvidia-glcore.so" \
|
|
snail.vglrun -d :8293 "$@" 2>/dev/null \
|
|
&& echo "Application $@ was performed on nVidia ;-)" && exit 0
|
|
|
|
echo "nvrun $@ returns an error. Here is nVidia X-server error log:"
|
|
grep '] (EE) ' /var/log/Xorg.8293.log
|
|
|
|
else
|
|
echo "Timout received for 'power on' request to Snail-daemon ;-("
|
|
fi
|
|
|
|
flock -u 9
|
|
|
|
} 9>$LOCK_FILE
|