Ubuntu This forum is for the discussion of Ubuntu Linux. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-28-2007, 02:02 AM
|
#1
|
Member
Registered: Apr 2007
Distribution: Feisty (Ubuntu Studio)/Edgy
Posts: 69
Rep:
|
Starting an app with increased priority.
I'm having a problem with Audacity. The sound breaks up on playback (didn't happen with Edgy).
I increased the priority using "nice -10". This got rid of the breakup. I'd like to start the program with a higher priority. I tried editing the launcher with "nice -10". "Sudo nice -10", "gksu nice -10", and "gksu nice -10". "Nice -10" set the priority at +10 not -10. Audacity wouldn't start with the others.
How can I raise the priority at its startup?
Using Feisty and ALSA with a M-Audio 2496 card. Audacity and Envy24 Control are usually the only apps running when recording or playing back.
|
|
|
04-28-2007, 11:33 AM
|
#2
|
LQ Newbie
Registered: Jan 2006
Location: Missouri
Distribution: Gentoo 2007.0 x86 & amd64
Posts: 25
Rep:
|
Executing the command with "sudo nice -n -10 audacity" will do it. However, this runs the program as root, which you probably do not want. I'd look into the configuration of ALSA to ensure that it runs with as high of a priority as possible.
|
|
|
04-28-2007, 12:19 PM
|
#3
|
Member
Registered: Apr 2007
Distribution: Feisty (Ubuntu Studio)/Edgy
Posts: 69
Original Poster
Rep:
|
I'd rather not run as root but I already have to with jackd (not needed for Audacity but for Ardour and Hydrogen to use realtime access).
That executes Audacity with nice at -10 from the terminal. I'm not sure how to raise ALSA's priority. "Mixer_applet2" is the only process running. I guess that is ALSA. Guess I'll go to the ALSA site and see what I can find there. Thanks.
|
|
|
04-28-2007, 02:11 PM
|
#4
|
Member
Registered: Apr 2007
Distribution: Feisty (Ubuntu Studio)/Edgy
Posts: 69
Original Poster
Rep:
|
I found another way that might allow higher priority. "/etc/security/limits.conf" sets limits on groups. I can set my main group or the audio group at priority -10, however most all processes are set to this. Audacity doesn't breakup but the mouse is very jumpy. I don't know if there is another way to use this file to get just the audio processes to run at a higher priority without raising the priority of all processes. Thoughts?
|
|
|
04-28-2007, 08:59 PM
|
#5
|
LQ Newbie
Registered: Apr 2007
Posts: 7
Rep:
|
I created an alias in my .bashrc file to do such things:
alias prioritize='~/scripts/prioritize.sh'
and in the script:
#!/bin/bash
sudo nice -$1 sudo -u <PutYourUserNameHere> $2
It could probably be done all in one line in .bashrc though.
It uses root privalage to set the priority to whatever you want and then runs the actual program with the more restrictive privalages. Just make sure that you have sudoers set up correctly.
Hope this way helps!
|
|
|
04-29-2007, 02:50 AM
|
#6
|
Member
Registered: Apr 2007
Distribution: Feisty (Ubuntu Studio)/Edgy
Posts: 69
Original Poster
Rep:
|
Thanks for replying. I'm afraid you have gotten over my head. I'm not sure how to write such a script. I tried editing sudoers (in another matter) but couldn't get it to save the edits. I used visudo to open the file but while it appeared to be saved, it wasn't. Could you perhaps provide more detail on both the script and how to edit (and save) sudoers?
|
|
|
05-06-2007, 12:27 AM
|
#7
|
LQ Newbie
Registered: Apr 2007
Posts: 7
Rep:
|
>>Could you perhaps provide more detail on both the script and how to edit (and save) sudoers?
Did you run visudo with root privileges? (sudo visudo)?
Also, the default editor that visudo opens is dependent on how it was originally compiled. On my Feisty installation it opens in nano and saving is a matter of answering 'y' when prompted on exiting. If visudo opens vi you might try typing :wq on exiting? I don't know why else it might be discarding your changes.
Maybe use your favorite text editor (with root privileges) to open /etc/sudoers instead? Just be sure to only have one copy open at a time.
As for the script:
open ~/.bashrc in a text editor (it's a hidden file)
scroll down to the "# Alias definitions." section.
add alias prioritize='~/scripts/prioritize.sh'
now save, quit, and create a text file called prioritize.sh in a folder called scripts in your home directory.
Open it and add (with your username substituted for <PutYourUserNameHere>)
#!/bin/bash
sudo nice -$1 sudo -u <PutYourUserNameHere> $2
Save, quit.
reset your terminal/open a new one, and I believe it should work.
usage: sudo prioritize -5 "audacity"
This should run audacity with your normal privileges at priority -5.
Hope I was clearer this time :-)
|
|
|
05-07-2007, 11:19 PM
|
#8
|
Member
Registered: Apr 2007
Distribution: Feisty (Ubuntu Studio)/Edgy
Posts: 69
Original Poster
Rep:
|
Thanks for the reply. Sorry about not getting back sooner.
I tried the code you gave but get the message:
Quote:
sudo: prioritize: command not found
|
The directory with prioritize.sh is in the path. I tried both setting it as executable and not executable. It seems the alias in .bashrc isn't happening as expected.
Here is the line I used:
Quote:
alias prioritize='/home/pk/bin/prioritize.sh'
|
I went with a directory that I created a while back "~bin" but I don't see that as the problem.
I really have no idea what I've done wrong.
|
|
|
05-08-2007, 11:23 PM
|
#9
|
LQ Newbie
Registered: Apr 2007
Posts: 7
Rep:
|
Hmm... Thats odd...
A couple things to try:
Quote:
sudo sh /home/pk/bin/prioritize.sh -5 "audacity"
|
Just to be sure that it works.
If it does then try typing
Quote:
alias prioritize='/home/pk/bin/prioritize.sh'
|
directly into the console. If prioritize works after that, then there's probably something wrong with where you added the prioritize line into .bashrc . Make sure that its not between a "if" line and a "fi" line.
|
|
|
05-09-2007, 11:37 AM
|
#10
|
Member
Registered: Apr 2007
Distribution: Feisty (Ubuntu Studio)/Edgy
Posts: 69
Original Poster
Rep:
|
The first line worked and started the app.
The second didn't. It just dumped me right back to the prompt. With sudo, I get "sudo: alias: command not found".
Here are the lines from .bashrc:
Quote:
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
# prioritize Audacity
alias prioritize='/home/pk/bin/prioritize.sh'
#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi
# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
|
Just trying something:
After running the alias prioritize='/home/pk/bin/prioritize.sh' command, if I then type "prioritize" I get this
Quote:
pk@pk-desktop:~$ prioritize
Password:
nice: -: No such file or directory
|
|
|
|
05-10-2007, 01:06 AM
|
#11
|
LQ Newbie
Registered: Apr 2007
Posts: 7
Rep:
|
It looks like you're missing "nice," which generally comes with Linux. If typing nice into the command prompt produces that error, then maybe you need the nice package. I'd try:
Code:
sudo apt-get install util-linux util-linux-locales
|
|
|
05-10-2007, 10:13 PM
|
#12
|
Member
Registered: Apr 2007
Distribution: Feisty (Ubuntu Studio)/Edgy
Posts: 69
Original Poster
Rep:
|
Looks like I have both packages you mentioned.
Quote:
util-linux is already the newest version.
util-linux-locales is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
|
Maybe the argument is phrased incorrectly. It looks like the "-" may be what the error is about.
|
|
|
05-11-2007, 11:02 AM
|
#13
|
LQ Newbie
Registered: Apr 2007
Posts: 7
Rep:
|
So, what happens when you run
Code:
prioritize -5 "audacity"
I guess it probably shouldn't work without those arguments anyway.
|
|
|
05-11-2007, 04:41 PM
|
#14
|
Member
Registered: Apr 2007
Distribution: Feisty (Ubuntu Studio)/Edgy
Posts: 69
Original Poster
Rep:
|
That works but sadly running Audacity with increased priority doesn't seem to have eliminated all the problems I'm having. I started another thread about returning to Edgy. I didn't have these problem with Edgy.
Thanks for all your help. It was great of you to take the time to make such a valiant effort. I really appreciate it.
|
|
|
All times are GMT -5. The time now is 06:23 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|