Reply
Thread Tools
Posts: 44 | Thanked: 0 times | Joined on Jan 2009
#1
Hi!

I have N810. How can I write a short script to do the following?
Get the pid of a process like:

ps | grep <your_app_name> | cut -b 1-5 | head -1

and then use that pid number in the 'renice' command to put the priority higher like:

renice -20 -p 1735
 
JosefA's Avatar
Posts: 71 | Thanked: 54 times | Joined on Oct 2009
#2
Originally Posted by sangean99 View Post
Hi!

I have N810. How can I write a short script to do the following?
Get the pid of a process like:

ps | grep <your_app_name> | cut -b 1-5 | head -1

and then use that pid number in the 'renice' command to put the priority higher like:

renice -20 -p 1735
Code:
renice -20 $(pidof appname)
Ought to do it, I think.
__________________
$HOME - On special days, this sig will contain a hidden Andalusian Video Snail. Today is not such a day.
 
Posts: 44 | Thanked: 0 times | Joined on Jan 2009
#3
Hi thanks!

Can you write down the whole code that I should put into a script file?

I guess first the script should find out the pid# and then in the next line use that pid# with the renice command.

I could execute that automatically.
 
Posts: 543 | Thanked: 181 times | Joined on Aug 2009 @ Universe,LocalCluster.MilkyWay.Sol.Earth.Europe.Slovenia.Ljubljana
#4
The above is the whole code.

Code:
#!/bin/sh
renice -20 $(pidof $1)
Name it whatever you want.sh chmod +x it then run it with:

./wahtever you want.sh appname
 
Posts: 44 | Thanked: 0 times | Joined on Jan 2009
#5
ok, but renice command needs root. if i put root into script then it enters root but it continues the script only when i type exit from root.
 
Posts: 543 | Thanked: 181 times | Joined on Aug 2009 @ Universe,LocalCluster.MilkyWay.Sol.Earth.Europe.Slovenia.Ljubljana
#6
Use:
Code:
sudo renice -20 $(pidof $1)
Instead of plain renice and edit your /etc/sudoers file to allow running renice without a password.
 
Posts: 44 | Thanked: 0 times | Joined on Jan 2009
#7
Ok, I have found directory: /etc/sudoers.d
It has 7 files. I made a copy but I dont know the path of renice.
whereis command does not work. How to find out?
and where is the ping command located? That needs root also.
I also tried to search with Midnight Commander for ping file but it didnt find it.
 
Posts: 236 | Thanked: 223 times | Joined on Oct 2009 @ NE UK
#8
Originally Posted by sangean99 View Post
I dont know the path of renice.
whereis command does not work. How to find out?
You want this:

# which renice
/usr/bin/renice
 
Posts: 44 | Thanked: 0 times | Joined on Jan 2009
#9
Well, I have the following files in /etc/sudoers.d directory:

01sudo
flash-and-reboot.sudoers
hildon-application-manager.sudoers
hildon-input-meth~igurator.sudoers
osso-af-startup.sudoers
osso-app-killer.sudoers
ukeyboard.sudoers

The first one has the most lines.

So to which one should I include the following line?

user ALL = NOPASSWD: /usr/bin/renice

I put it into the first file but it still doesn work without root.
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:56.