launchd script not running for user login in OS X Tiger 10.4.11

Joined
Mar 15, 2015
Messages
1
Reaction score
0
Points
1
Location
Decatur, Ill USA
Your Mac's Specs
Mac OS X 10.4.11 Tiger 1.8 GHz PowerPC G5 2 GB DDR SDRAM
Hello, yes I know it's a very old system, but I am coming from years of Windows (hope you don't hold that against me :p ) and Linux and my dad died so I got his old PPC G5. I have written scripts on Windows and Linux to shutdown the computer when a specific user logs in so that my children can only get on at certain times and I don't have to use any 3rd party applications to do what I should be able to do myself... anyway I worked out a script that runs perfectly from the terminal and yet I can't seem to get it to run from a users ~/Library/LaunchAgents/ folder. I've tried several variations of permissions and ownership changes and of course, default, but it won't seem to run. I can get it to run with:
Code:
defaults write com.apple.loginwindow LoginHook /where/my/script/is
but then it runs for everyone.
Here's the code:
Code:
prepDate=`date`
read p1 p2 p3 p4 p5 <<< "${prepDate//:/ }"
if [[ $p4 -gt 16 && $p4 -lt 21  ]] 
	then 
		shutdown -h now
fi
Plist in /Users/<username>/Library/LaunchAgents/:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>ServiceTime</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Users/username/nottime</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>


I tried sudo in the shutdown command too and no go. I tried setting the account that I'm trying to shutdown to Standard User and it didn't work either. And I have adjusted the times accordingly to when I am testing them manually and again they work fine from terminal.


Really it's not a big deal as I am just going to use it for an internet and media console for them and I can still use the LoginHook as I have access to Single User Mode. Maybe eventually I'll get a newer Mac when I can find some extra cash lol but for now gotta stick with this old thing. It runs really well though for being that old.
 
Last edited:

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top