Launchd and Lftp

jax115

Registered
Hi,

I am using ftp to sync an ftp server with a local folder. I have a shell script I am able to execute using the terminal. I am using Lingon to add a plist to the lauchd program so that the shell script runs hourly. The shell script ususes lftp to sync. But when launchd tries to execute the script I get an error from lftp "lftp: command not found". What am I missing? thanks

Below is the plist I am using:

Code:
<?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>Disabled</key>
	<false/>
	<key>KeepAlive</key>
	<true/>
	<key>Label</key>
	<string>Torrent Sync</string>
	<key>Program</key>
	<string>lftp</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Users/harounsharif/Desktop/Downloads/synctorrents.sh</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>StartInterval</key>
	<integer>60</integer>
	<key>WorkingDirectory</key>
	<string>/Users/harounsharif/Desktop/Downloads</string>
</dict>
</plist>
 
Maybe I could accomplish the same thing with Cron. I realize there are a multitude of cron tutorials out there but for some reason I do not seem to have a cron file, and the cron -e command only creates a temporary one. If I do create a crontab file how do I direct cron to it? I am on OSX 10.7.

Any ideas greatly appreciated
 
Drop the following four items from the plist file:
  • Disabled - not necessary from 10.6
  • KeepAlive - not necessary in your circumstance
  • Program - you are using it incorrectly and it's not necessary due to you having specified the actual script in ProgramArguments
  • RunAtLoad - not necessary in your circumstance
Change this :
  • Label : user.harounsharif.torrentsync
Save the plist file as user.harounsharif.torrentsync.plist in the apporpriate place.

You can find a description of the possible values in a launchd plist file here : launchd.plist(5) Mac OS X Manual Page
 
You don't have a cron file because Apple really want's to replace it with launchd jobs.

There are at least 4 ways of scheduling jobs to run :
  1. launchd
  2. periodic
  3. cron
  4. at
Apple is using the first 2 and in some circumstances I'm using cron too because it's much easier to re-schedule and edit cron jobs. Otherwise, I write launchd plist files for services or I add mantainance jobs to periodic .
 
Back
Top