Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Results 1 to 5 of 5
  1. #1
    michaelsanford is offline Translator, Web Developer
    Join Date
    Oct 2002
    Location
    Ottawa/Montréal
    Posts
    2,280
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Set a static nice value for an executable?

    For example, I want Mail.app ALWAYS to start with a nice value of 5.

    How would I go about doing that, if it's possible at all (but this is linux, I'm sure it's possible )

    Thanks!

  2. #2
    anarchie is offline NSCoder
    Join Date
    Oct 2002
    Posts
    198
    Thanks
    0
    Thanked 0 Times in 0 Posts
    To the best of my knowledge, no. Your best bet would be to create a shell script which runs your executable using nice. In the case of application packages, you can simply move the executable aside and put in its place that shell script. Here's what I used for Mail:

    Code:
    #!/bin/sh
    nice -n +5 $0.bak $1
    I had moved Mail to Mail.bak, saved this shell script as Mail, then ran 'ps -xO nice' to verify my success (irrelevant lines removed):

    Code:
      PID NI  TT  STAT      TIME COMMAND
     1180  5  ??  SN     0:06.05 /Applications/Mail.app/Contents/MacOS/Mail.bak -psn_0_9043969
    anarchie%
    I can't guarantee that this will work for all programs, as some finicky ones (*cough* STARCRAFT *cough*) seem not to obey all kinds of guidelines. Note that I couldn't use ./Mail.bak because applications launched by the Finder (Launch Services actually) have their working dir at /. Also note that I included $1, to preserve LS's -psn_X_XXXXXXX argument. Someday I'll know what it really means.

  3. #3
    michaelsanford is offline Translator, Web Developer
    Join Date
    Oct 2002
    Location
    Ottawa/Montréal
    Posts
    2,280
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Cool, but why did you have to rename Mail.app to Mail.bak?

  4. #4
    anarchie is offline NSCoder
    Join Date
    Oct 2002
    Posts
    198
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I didn't. I renamed Mail.app/Contents/MacOS/Mail to Mail.app/Contents/MacOS/Mail.bak, so that I could have my own program at Mail.app/Contents/MacOS/Mail so that it runs when I double-click Mail.app. I suppose I could have altered the CFBundleExecutable key in its Info.plist instead. Works either way.

  5. #5
    michaelsanford is offline Translator, Web Developer
    Join Date
    Oct 2002
    Location
    Ottawa/Montréal
    Posts
    2,280
    Thanks
    0
    Thanked 5 Times in 5 Posts
    OH! I get it, thanks!

 

 

Similar Threads

  1. Replies: 8
    Last Post: November 2nd, 2003, 07:03 PM
  2. HOW TO STOP SPAM -- join the fight!
    By GadgetLover in forum Apple News, Rumors & Discussion
    Replies: 11
    Last Post: April 11th, 2002, 02:52 PM
  3. AppleScript, iTunes, Mp3 Tags, idea and problem
    By jove in forum Software Programming & Web Scripting
    Replies: 0
    Last Post: March 11th, 2002, 04:03 PM
  4. how would I zip files?
    By themacko in forum Mac OS X System & Mac Software
    Replies: 14
    Last Post: February 18th, 2002, 04:32 AM
  5. vignette client on mac os x
    By erim in forum Software Programming & Web Scripting
    Replies: 8
    Last Post: July 13th, 2001, 01:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •