As a continuation from my initial question...

Routinely backup log file in OSX?

I'm attempting to backup a logfile on an OSX computer and a jailbroken iPhone. LaunchD was recommended as a solution and some Google searches later revealed LingOn to be the tool to use.

The output (after me filling the fields) gives me this PList:

<?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">

Now running my python script by invoking it in the terminal will successfully send the email to my inbox with the attachments I need.

LaunchD just doesn't launch though and I'm not sure why.

  • 1
    Have you registered your plist with launchctl? Where did you put this file? – Daniel Beck Jul 2 '11 at 10:36
  • Lingon puts the plist in /Library/LaunchDaemons/ – Ash Jul 2 '11 at 11:32
  • I also registered with sudo launchctl load w- com.ash.MySuperLaunchd – Ash Jul 2 '11 at 11:39
  • 1
    I thin you need to load the file path, not the arbitrary identifier you assign, at least the man page looks like that. Also, I recommend you make the script file executable, add a shebang header specifying the path to which python and execute it directly to circumvent PATH issues. Lastly, check /Applications/Utilities/Console.app for error messages. – Daniel Beck Jul 2 '11 at 12:18
  • 1
    I double checked the shebang header and it was not pointing to the right directory. My fault as I copy and pasted a script that was made for Linux. Everything is now working, only I do not know how to replicate this on the iPhone. – Ash Jul 2 '11 at 15:00

You need to load the agent. Either relogin, or launchctl load /path/to/file.plist.

RunAtLoad is false by default, so the script is run for the first time StartInterval seconds after it's loaded, in this case 3600.

The path in ProgramArguments needs to point to the permanent location of the script, so it probably shouldn't be at ~/Desktop/. The target script doesn't need to be executable. But as correctly troubleshot by @DanielBeck in the comments, check that you're able to for example python /Users/ash/Desktop/sendemail.py in the first place and that the shebang line is correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.