Tips February 8, 2005 at 10:08 am

Preventing Login Window burn-in

Keep your monitors happy and ghost free

We have a number of machines here with colour calibrated monitors, and to keep this colour as constant as we can it means that power to the monitor can never be turned off. While modern monitors are certainly better than they used to be in dealing with burn-in, we noticed this was becomming an issue for us, so, here’s a tip on how to run the screensaver over the login window.First we want to create a very simple script. This script can live anywhere on the user’s system, although I keep mine on a mounted NFS share as it makes changing it on all machines much easier in the future.

Remember to chmod this script after writing it as an executable, i.e. chmod ugo+x loginsaver.sh

#!/bin/bash

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

(Do note that there is no line-break here, copying and pasting from this webpage should work for you)

This is what runs the screensaver, and checks to make sure there isn’t a console user logged in.

This is all well and good, but for it to work fully the system will need to run this script at a predetermined interval, which is where cron comes into play. There’s an excelent article by Josh on how to play with cron here. So, what we’re looking to do here is set an interval that we want cron to run the loginsaver.sh script we just finished. For our example here I’ve set this to every minute:

*/1 * * * * root /usr/local/share/loginsaver.sh

(I’ve shown /usr/local/share as the path to the script for the moment, be sure to change this to wherever you intend to stash scripts on your file system)

You may want to make this longer for practicality – remember this script is really only checking if there’s a console user logged in, not if someone touched the mouse in the last 30 seconds or so – so if a user is in the process of logging in at the exact time that your cron job starts it may flip the screensaver on in that moment when your user is kicking themselves while trying to remember their password… Just touching the mouse again will of course bring you back to your login window.

About

Andrina Kelly is responsible for anything and everything touched by, or connected to, a Mac at Bell Media, Canada's premiere multimedia company. You may recognize her name from the end credits of Canada's evening news broadcast. She has previously spoken at MacSysAdmin, JAMF National Users Conference, Apple's WWDC, Macworld IT conferences, Mac Networkers Retreat, and Canada MacExpo.

No Comments

  • i think that would start the screensaver even if the user was logged in…

    bcirvin/


    Professional Services/Training
    MacOutfitters of Cranberry, PA
    “What guy would call his company ‘micro’ and ‘soft’?”

  • You can edit the system crontab with whatever editor (pico, vi, vim,
    emacs…) you like as long as you are an admin.

    When using crontab to edit another user’s crontab file I would use the
    -u flag and be specific about it. Yeah sudo crontab -e
    opens the root tab, but it gets confusing sometimes.

    We have a really basic crontab article as well.


    Breaking my server to save yours.

    Josh Wisenbaker
    http://www.afp548.com

Leave a reply

You must be logged in to post a comment.