Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #359572
    andyinindy
    Participant

    Group:

    I use a modified version of Bombich’s logout script to manage home folders on my lab machines. Lately I have noticed that user folders are not being archived at logout. In other words, the script does not appear to be executing under certain circumstances (which I cannot replicate).

    Here is my script:

    —————————————————————————-

    #!/bin/bash

    uid=”$USER”
    home=”/Users/$uid”
    time=`date ”+%m-%d-%y_%H.%M.%S”`

    if [ “$uid” = “infores” ]; then

    rm -f /Library/Classic/Classic.dmg.shadow

    exit 0

    else

    echo “Refreshing home directory.”

    rm -f /Classic.dmg.shadow

    mkdir -m 755 “/private/tmp/$uid.$time”
    mv $home “/private/tmp/$uid.$time”

    fi

    rm -f /Library/Classic/Classic.dmg.shadow

    exit 0

    —————————————————————————-

    “infores” is a local admin account, so I don’t want to remove it.

    The file is owned by root, group is wheel, permissions are rwx-r-x-r-x. It lives in /private/var/root/Scripts. Loginwindow.plist is modified accordingly.

    Again, this works properly in almost all cases. However, it sometimes inexplicably refuses to run!

    Any advice appreciated!

    –Andy

    #359631
    andyinindy
    Participant

    MacTroll:

    Thanks for the reply.

    After further testing, the script, although unnecessarily complex, works fine. The problem was with the com.apple.loginwindow.plist file. For some reason it had become corrupted, and the LogoutScript portion was missing!

    Any idea as to why this preference file gets borked occasionally? I’m beginning to think that I should be using Radmind or something similar to ensure that these crucial files do not get screwed up…

    For those who are interested, here’s how I simplified my script:

    #!/bin/bash
    
    uid="$USER"
    home="/Users/$uid"
    time=`date ''+%m-%d-%y_%H.%M.%S''`
    
    if [ "$uid" != "infores" ]; then
    
    rm -f /Library/Classic/Classic.dmg.shadow
    
    mkdir -m 755 "/private/tmp/$uid.$time"
    mv $home "/private/tmp/$uid.$time"
    
    fi
    
    exit 0
    
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Comments are closed