Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am developing a automated system, which consists of 3 parts: mysql, bash and launchd. Bash script takes folders of work related stuff, zips, archives and puts info about them into database that is located on a local MAMP server. Everything works as expected when I run the script from terminal. But when I use Launchd to automatically run this script, it functions without errors and it does not put the values into database.

I've tried to make logs of returned messages, but the logs end up being empty as the command has run the way it was supposed to.

Any help would be appreciated!

.plist contents

<?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>com.adevo.ari.zip</string>

  <key>ProgramArguments</key>
  <array>
    <string>/Volumes/Archive-Plus/B-ARCHIVE-PLUS/ZZ_UTILITY_FOLDER/Compress.sh</string>
  </array>

  <key>Nice</key>
  <integer>1</integer>

  <key>StartInterval</key>
  <integer>120</integer>

  <key>RunAtLoad</key>
  <true/>

</dict>
</plist>

I made this .plist file just by searching the web.

As far as I understand the problem is in the launchd plist file. It somehow doesnt give the "range" to use mysql database.

share|improve this question
    
check permissions for lunchd to destination file/database/called script etc. try setting SUID for lunchd executable. –  mnmnc Dec 18 '12 at 13:24
    
I guess i did not mention that I run this script as administrator and everything this script does, it does as adminstrator –  Armands Dec 19 '12 at 12:56
    
When you run this manually you run it by admin and everything works. But when it runs automatically - are you sure it is running as administrator? –  mnmnc Dec 19 '12 at 13:04
    
Well, how exactly should I verify that? For example when the script just makes a folder, and it is run by launchd, it shows that it was made by admin. –  Armands Dec 19 '12 at 13:34
    
if the program is called launchd then use command watch -n1 'ps aux | grep launchd' this will check each second for launchd program and show you the user that started the command –  mnmnc Dec 19 '12 at 13:39
show 9 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.