osx - perl script run from inside launchd failing with "No such file or directory" for 'system' commands -


i've got perl script (which run on linux & windows well) i'm trying run via launchd on osx-10.8.3. i'm inexperienced in writing plist files, i'm hoping silly i've overlooked. should note runs fine via cron on osx, problems i'm encountering specific launchd. however, when attempt run via launchd, erroring out on perl 'system' calls, claiming "no such file or directory". here's plist:

<?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>launched.sysinv</string>         <key>programarguments</key>         <array>                 <string>/usr/bin/perl</string>                 <string>/users/lfriedman/cuda-stuff/sw/gpgpu/build/scripts/testing/sysinv.pl</string>         </array>         <key>runatload</key>         <true/>         <key>startcalendarinterval</key>         <dict>                 <key>hour</key>                 <integer>14</integer>                 <key>minute</key>                 <integer>30</integer>         </dict>         <key>username</key>         <string>lfriedman</string>         <key>abandonprocessgroup</key>         <true/>         <key>standardoutpath</key>         <string>/tmp/sysinv.out</string>         <key>standarderrorpath</key>         <string>/tmp/sysinv.err</string> </dict> </plist> 

when load script "launchctl load -w launchd.sysinv.plist", see following error in /var/log/system.log:

com.apple.launchd[1] (launched.sysinv[51676]): exited code: 1 

/tmp/sysinv.out has following output each invocation:

system(/usr/sbin/system_profiler -detaillevel full &> system_profiler.txt) failed: no such file or directory 

/tmp/sysinv.err has single error (with each invocation):

sh: system_profiler.txt: permission denied 

i'm confused causing errors. again, running perl script manually (as 'lfriedman' user) or via cronjob (owned 'lfriedman') works fine, no errors.

when run script via plist, system call writing output (system_profiler.txt) directory not have permissions write to. when run manually or cron, writes directory has appropriate permissions.

edit script point output directory have permissions for, e.g. /usr/sbin/system_profiler -detaillevel full &> /tmp/system_profiler.txt


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -