I would like to create a login script to display our school Acceptable Use Policy i.e. 6 simple rules when logging on.
Here is the script the I received from another forum:
[b]#!/bin/sh
echo “1. Rule1” > /tmp/rules
echo “2. Rule2” >> /tmp/rules
echo “3. Rule3” >> /tmp/rules
echo “4. Rule4” >> /tmp/rules
echo “5. Rule5” >> /tmp/rules
echo “6. Rule6” >> /tmp/rules
rules=osascript -e "tell application \"Finder\"" -e "activate" -e "display dialog (do shell script \"cat /tmp/rules\") buttons {\"Decline\",\"Accept\"} default button 2" -e "end tell"
if [ “$rules” == “button returned:Decline” ]; then
killall WindowServer
fi
exit 0 [/b]
The script runs when tested through the terminal.
I have ensured that teh script is executable by running the command: chmod u+x /path/to/login.sh
Followed by defaults write /Library/Preferences/com.apple.loginwindow LoginHook /path/to/login.sh
However when I restart the machine the script does not run. Our client authenticate via LDAP, could this be a reason for the script not executing?
The loginhook is displayed in - com.apple.loginwindow loginhook.
Any help would be greatly appreciated, i’m obvuiously missing a fundamental step!