shoemoney

gw2 bash renice

Mar 12th, 2013
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.06 KB | None | 0 0
  1. #!/bin/bash
  2. OLDPID='a'
  3.  
  4. while true; do  #check if gw2 is running
  5.  
  6.         GW2PID=`ps -A | grep -m 1 'Gw2' | awk '{print $1}'`
  7.         WINESVRPID=`ps -A | grep -m 1 'wineserver' | awk '{print $1}'`
  8.         WINEDEVPID=`ps -A | grep -m 1 'winedevice.exe' | awk '{print $1}'`
  9.  
  10.         if [ ! $GW2PID ]; then
  11.                 echo 'Guild Wars 2 is not running'
  12.                 echo 'Processor is downgrading'
  13.         elif [ $OLDPID != $GW2PID ]; then
  14.                         echo 'Guild Wars 2 is getting tuned'
  15.                         OLDPID=$GW2PID
  16.                         renice -n -20 $GW2PID
  17.                                 renice -n -20 $WINESVRPID
  18.                                 renice -n -20 $WINEDEVPID
  19.                                
  20.                                 taskset -cp 0-5 $WINESVRPID     #set to use core 0 to 6
  21.                         taskset -cp 0-5 $WINEDEVPID
  22.                         taskset -cp 0-5 $GW2PID
  23.                         echo 'Processor is optimizing'
  24.                         exit    #ends the script
  25.                 else
  26.                         echo 'Guild Wars 2 is already tuned.'
  27.         fi
  28.         sleep 15
  29. done
Advertisement
Add Comment
Please, Sign In to add comment