openSUSE Forums > Programming/Scripting » Starting process with higher priority

Go Back   openSUSE Forums > Programming/Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-Nov-2009, 12:36
atomixkriko's Avatar
Puzzled Penguin
 
Join Date: Jun 2008
Posts: 22
atomixkriko hasn't been rated much yet
Default Starting process with higher priority

So I've created a script which starts
Code:
sudo setPrio.sh ~kriko/bin/playonlinux-bin/playonlinux -15;
This works, but not if I try to start the same thing under another xorg instance.

Sound fails to start and so does all games.

for e.g.:
xinit playonlinux.sh -- :1

will call:
Code:
sudo setPrio.sh ~kriko/bin/playonlinux-bin/playonlinux -15;
and setPrio.sh is:
Code:
#! /bin/bash

APP="$1"
PRIO="$2"
PARAMS="$3"
PID=0

if [ $2 ] ; then
  echo "ok, priority set to $2";
else
  PRIO=0
  echo "priority set to 0";
fi

function run {
#  xhost +localhost
  powersave -f
  powersave -c
  nvidia-settings --assign="SyncToVBlank=1"
  echo $APP
#  exit 1
#  nice -n $PRIO sudo -u kriko $APP "$PARAMS" -- :1 &
  nice -n $PRIO sudo -u kriko $APP "$PARAMS" &
  PID=$!
  sleep 5
}

function loopCheck {
echo $PID
  search=$(ps --pid $PID -o comm=)

  if [ $search ] ; then
#    renice $PRIO $PID;
    sleep 15;
    loopCheck;
  else
    getOut;
  fi
}

function getOut {
  nvidia-settings --assign="SyncToVBlank=0"
#  powersave -A
#  xhost +
#  xhost +localhost
  exit 0
}

run;
loopCheck;
getOut;
and I'm not able to figure out why. same thing works if started under xorg :0 instance but not under :1 :S
Reply With Quote
Reply

Bookmarks


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2