wondering if any of you could kindly provide some insight.
I’m writing some scripts in order to automate the connection to VLC which is being hosted by one of our servers this is so that our customer endpoints will automatically connect to the stream, much like a screensaver but displaying ads and updates.
I have setup Sleepwatcher on one of the endpoints for testing and have written a few scripts which I have listed below:
#!/bin/sh /Users/Shared/ScreenSaverAutomation/sleepwatcher/sleepwatcher -V -i /Users/Shared/ScreenSaverAutomation/VLC.scpt -t "100" -R /Users/Shared/ScreenSaverAutomation/KillVLC.scpt
cd /Applications/VLC.app/Contents/Resources/English.lproj/ mv ErrorPanel.nib ErrorPanel.nib.orig alias vlc="/Applications/VLC.app/Contents/MacOS/VLC" osascript -e 'tell app "Terminal" do script "/Applications/VLC.app/Contents/MacOS/VLC --no-audio --no-video-title-show --mouse-hide-timeout 10 --fullscreen --quiet --repeat --loop --macosx-nativefullscreenmode --http-reconnect http://Local.Server.Address:Port" end tell'
killall VLC killall Terminal
A brief explanation of these scripts is that the wrapper script is ran by the Daemon every 30 seconds, this is located in /Library/LaunchDaemons/com.cellar.sleepwatcher.plist, the contents of this plist are as follows:
<?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>com.cellar.sleepwatcher</string> <key>ProgramArguments</key> <array> <string>/Users/Shared/ScreenSaverAutomation/BashWrapper.command</string> </array> <key>KeepAlive</key> <true/> <ke y>StartInterval</key> <integer>30</integer> <key>StandardOutPath</key> <string>/private/tmp/com.cellar.sleepwatcher.stdout</string> <key>StandardErrorPath</key> <string>/private/tmp/com.cellar.sleepwatcher.stderr</string> </dict> </plist>
When these scripts are triggered by the wrapper command manually, everything runs perfectly – however on system boot, on any user, this does not run automatically. Additionally, when I run launchctl list | grep com.cell my Plist does not appear in the list of running Daemons, but in LaunchControl this is listed as running.
I have tried the following commands to get this service to load properly:
sudo launchctl load /Libary/LaunchDaemons/com.cellar.sleepwatcher.plist
sudo launchctl bootstrap System/com.cellar.sleepwatcher.plist
sudo launchctl enable /Libary/LaunchDaemons/com.cellar.sleepwatcher.plist
I seem to be mostly getting service already loaded, operation already in progress errors from the above commands, but when I check again with launchctl list | grep com.cell it does not appear in the list of launched Daemons.
I don’t suppose anyone else has had a little more experience with this? This is my first foray into the Mac side of scripting and so I do feel a little lost at this point! Any help or insight is greatly appreciated.