Guest User

SC2 start script

a guest
Jan 8th, 2012
669
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. chmod -w ~/StarCraft\ II/Variables.txt
  3. kernvar1=`sysctl -n kernel.sched_child_runs_first`
  4. kernvar2=`sysctl -n kernel.sched_rt_period_us`
  5. kernvar3=`sysctl -n kernel.sched_rt_runtime_us`
  6. kernvar4=`sysctl -n kernel.sched_nr_migrate`
  7. kernvar5=`sysctl -n kernel.sched_latency_ns`
  8. echo "KERNEL PARAMETER BACKUP DONE"
  9. sudo -v
  10. sudo sysctl -w kernel.sched_child_runs_first=1
  11. sudo sysctl -w kernel.sched_rt_period_us=960000
  12. #sudo sysctl -w kernel.sched_rt_runtime_us=-1
  13. sudo sysctl -w kernel.sched_nr_migrate=48
  14. sudo sysctl -w kernel.sched_latency_ns=8000000
  15. echo "CHANGED KERNEL PARAMETERS"
  16. sudo cpufreq-set -c 0 -g performance
  17. sudo cpufreq-set -c 1 -g performance
  18. echo "CPU GOVERNOR: PERFORMANCE"
  19. echo "STARTING SC2 NOW"
  20. WINEDEBUG=-all wine ~/.wine/drive_c/Programme/StarCraft\ II/StarCraft\ II.exe -opengl -fullproc -skipopenal -nocpubinding -confinecursor
  21. sleep 30s
  22. wineserver --debug=0
  23. sudo renice -n -10 `pidof SC2.exe`
  24. sudo renice -n -10 `pidof wineserver`
  25. sudo taskset -p 1 `pidof SC2.exe`
  26. sudo taskset -p 2 `pidof wineserver`
  27. i=0
  28. while ps ax | grep -v grep | grep SC2.exe > /dev/null
  29. do
  30. echo -n $i _
  31. sleep 60s
  32. let "i += 1"
  33. done
  34. sudo cpufreq-set -c 0 -g ondemand
  35. sudo cpufreq-set -c 1 -g ondemand
  36. echo " "; echo "CPU GOVERNOR: ONDEMAND"
  37. sudo sysctl -w kernel.sched_child_runs_first=$kernvar1
  38. sudo sysctl -w kernel.sched_rt_period_us=$kernvar2
  39. sudo sysctl -w kernel.sched_rt_runtime_us=$kernvar3
  40. sudo sysctl -w kernel.sched_nr_migrate=$kernvar4
  41. sudo sysctl -w kernel.sched_latency_ns=$kernvar5
  42. echo "KERNEL PARAMETERS BACK TO NORMAL"
  43. wineserver -k
  44. unset kernvar1 kernvar2 kernvar3 kernvar4 kernvar5
  45. echo "FINISH"
  46. #WINEDEBUG=-all wine ~/.wine/drive_c/Programme/StarCraft\ II/StarCraft\ II.exe -opengl -fullproc -skipopenal -nocpubinding -confinecursor
  47. ## INSTALLATION: mount commands
  48. #mount -l
  49. #sudo mount -o remount,unhide /dev/sr0/ /media/SC2*
  50. ###sudo umount /media/SC2*
  51. ###sudo mount -t udf -o ro,unhide,uid=$(id -u) /dev/cdrom /media/cdrom
RAW Paste Data