Created
January 25, 2013 15:20
-
-
Save sauy7/4635178 to your computer and use it in GitHub Desktop.
Example launchd plist file and shell script etc. for debugging the environment when running scripts as a user.
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
# How to get running and monitor | |
chmod 777 /Users/username/bin/debug.sh | |
launchd unload -w /Library/LaunchDaemons/debug.plist | |
launchd load -w /Library/LaunchDaemons/debug.plist | |
tail -f /Users/username/tmp/debug.stderr.log | |
tail -f /Users/username/tmp/debug.stdout.log |
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>debug</string><!-- this one should match the file name, sans .plist --> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/Users/username/bin/debug.sh</string><!-- good idea if this is similar to the Label --> | |
</array> | |
<key>StartInterval</key> | |
<integer>15</integer> | |
<key>StandardOutPath</key> | |
<string>/Users/username/tmp/debug.stdout.log</string> | |
<key>StandardErrorPath</key> | |
<string>/Users/username/tmp/debug.stderr.log</string> | |
<key>AbandonProcessGroup</key> | |
<true/> | |
</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/sh | |
# Check what environment variables are already set | |
echo $PATH | |
# Amend, or set as needed: | |
#PATH=/usr/local/bin:$PATH | |
# Executables: | |
which ruby | |
ruby -v | |
# Gems/libraries: | |
gem list | |
# Now you'll know more before trying to run something like this: | |
#RAILS_ENV=production | |
#rake my:custom:task |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment