Last active
May 9, 2017 21:44
-
-
Save bryanzak/9180379 to your computer and use it in GitHub Desktop.
Script Runner. This is a Launch Agent and script launcher so we can have a folder of scripts that are run anytime a user logs in. This is very barebones and not even remotely fancy, please feel free to share any feedback or suggestions you might have. Updated 2014-03-04 to support logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.yourorg.scriptrunner</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/Library/yourorg/ScriptRunner.sh</string> | |
</array> | |
<key>QueueDirectories</key> | |
<array/> | |
<key>StandardOutPath</key> | |
<string>/var/log/yourorg-scriptrunner.log</string> | |
<key>StandardErrorPath</key> | |
<string>/var/log/yourorg-scriptrunner.log</string> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>WatchPaths</key> | |
<array/> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# save this file at /Library/yourorg/ScriptRunner.sh | |
script_path="${0}" | |
source_path=$(dirname "${script_path}") | |
chmod 777 "/var/log/yourorg-scriptrunner.log" | |
if [ -d "${source_path}/User Login Scripts" ]; then | |
cd "${source_path}/User Login Scripts" | |
for item in *; do | |
echo "### $(date) BEGIN ${item}" | |
"./${item}" | |
echo "### $(date) END ${item}" | |
done | |
fi | |
chmod 777 "/var/log/yourorg-scriptrunner.log" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment