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


Click here to return to the 'Quick Update...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Quick Update...
Authored by: XyberICE on Jun 16, '04 12:36:40AM
Running the ScreenSaverEngine directly is indeed troublesome as Basilisk pointed out. I found this shortly after I posted the hint so I wrote a short shell script that is run by cron instead:

#! /bin/csh

set engineRunning=`/bin/ps -auxww | /usr/bin/grep ScreenSaverEngine| /usr/bin/grep -v grep`

if("$engineRunning" == "" ) then
        exec /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -idleCheck
endif
With respect to enabling root, you do enable the "root" user once to set your Desktop & Screensaver preferences; however, you do not need to leave (nor should you) the "root" account enabled. The preferences, once written, are read on display of the ScreenSaver from the Login Window. You could also, as Greg intimates, not ever enable the "root" user and simply have the default ScreenSaver display within the default time (this just wasn't an interesting choice to me).

I had also d/l'd the Perl Scripts and App from: http://clc.its.psu.edu/Labs/Mac/Resources/psuscreensaver, but I thought this was a less invasive solution (and possibly easier to execute).

[ Reply to This | # ]

Quick Update...
Authored by: TrumpetPower! on Jun 16, '04 10:48:58AM

Golly gee, there ain't no good reason why you should have to use so much unnecessarily excessive extraneous verbiage on something like this here thingy.

ps acx | grep -q ScreenSaverEngine || /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -idleCheck

The ``c'' flag for ps restricts output to the process name only, without arguments; this prevents grep from matching itself (because just ``grep'' is shown in that line of the output). The ``q'' flag to grep is a GNUism that suppresses output. To be more portable, you'd redirect to /dev/null, but, since this'll only be run on OS X and OS X's grep is of the GNUish persuasion, we can let this one slide. The ``||'' is a conditional that only executes what follows if what preceded had a return code other than 0; grep only returns 0 if it finds something.

Cheers,

b&



[ Reply to This | # ]
Quick Update...
Authored by: Anonymous on Nov 30, '04 03:49:35PM

Just a quick addition that checks to see if anyone is logged in before checking to see if the ScreenSaverEngine is running.

/usr/bin/who | /usr/bin/awk '{ print $2 }'| grep console || ps acx | grep -q ScreenSaverEngine || /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -idleCheck



[ Reply to This | # ]
Quick Update...
Authored by: discordantus on Jan 21, '05 08:21:03PM

If we're eliminating verbiage, some happy shell globbing can tame that long pathname, too:

/System/L*/F*/Screen*/**/ScreenSaverEngine

expands to:

/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine

We could get it shorter, but I think this balances performance/error control/length pretty well.



[ Reply to This | # ]
Quick Update...
Authored by: alblue on Mar 02, '05 04:04:57AM

I'm pretty sure that the ** glob isn't a Bash-ism. You have to use single * characters.

Pity though, because ** is really handy in Ant/Maven scripts :-)



[ Reply to This | # ]