Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Run the screensaver in the Finder [10.2]' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Run the screensaver in the Finder [10.2]
Authored by: loadedsith on Feb 15, '06 09:05:00PM
I had some issues with using this with Electric-sheep.
Electric-sheep kept outputting text to my terminal.
Seems that Electric-sheep downloads sheep with bit-torrent and when its confused throws some errors to the terminal.
I needed to suppress to avoid having these appear at inopportune times. (aka:ever)
When i got this working it seemed like a bad idea to add this to my .bash_profile script, so i did (just like i never defrag anything, ever and how using the start menu to shutdown a windows box is for chumps)!
before you copy and paste this, make sure
 whereis nice
 whereis nohup
return /usr/bin/nice and /usr/bin/nohup, if not you should change the code respectively.
ps |grep ScreenSaver|grep -v grep||/usr/bin/nohup /usr/bin/nice -n 19 /System/Library/Frameworks/ScreenSaver.framework/Resources/ -background &
and here is the play by play.

returns the Screen saver process (among others)

grep ScreenSaver
searches for the ScreenSaver.
This will always also return the grep command thats searching for ScreenSaver, so we use

grep -v grep
to remove the grep line

ps |grep ScreenSaver.framework|grep -v grep||
will only run the echo command if the screen-saver isnt running

runs a process so it cant be stopped by a hang-up signal (when you close the terminal)

/usr/bin/nice -n 19
sets the following command to play nice, take up to 99% of the cpu if (and only if) the cpu has free cycles.
I stole this from some where that i cant find but i did find where they probably took it from:

/usr/bin/nohup /usr/bin/nice -n 19 
makes a nice uninterruptible process (electric-sheep was ending itself every so often, and so it stays running when the terminal is closed)
And finaly when you put it all together again an excerpt from my ~/.bash_profile:
ps |grep ScreenSaver.framework|grep -v grep||/usr/bin/nohup /usr/bin/nice -n 19 /System/Library/Frameworks/ScreenSaver.framework/Resources/ -background &
anyone who can is welcome to try this function out

function stopBgScreen { 
kill -9 `ps | grep ScreenSaver.framework | grep -v grep | awk '{print $1}'`
I wanted to include stopBgScreen in this post -> in my bash_profile, just incase anyone wanted it but i couldn't get functions inside of my bash_profile, which sort of redefines the bash_profile experience for me, as it works just fine in the terminal and even persists until log out, but i am having the same problem with alias, so maybe its something i did a long time ago.
Either way your welcome to use stopBgScreen.
Im not sure if the order of nohup -> nice is better then nice ->nohup, but thought it probably was.
That being said I couldn't see any difference.
Edited on Jan 25, '10 05:33:17AM by robg

[ # ]