The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - General (http://hintsforums.macworld.com/forumdisplay.php?f=16)
-   -   Need help running a command daily with launchd (http://hintsforums.macworld.com/showthread.php?t=48458)

mttsmnw 01-03-2006 10:31 AM

I actually have the same problem.
I saved my job in ~/Library/LaunchAgents/ but it never got executed at the time specified.

My .plist file was also a copy of periodic-daily, modified to suit my needs. Since it never got launched I finally gave up. But a few days later it suddenly launched, but not at the time specified! (The computer was definitly running at that the time specified)

So I started to examine this behavior. And I found out, that the daily/weekly/monthly scripts are also not launched at the specified time, but at some time, which seems quite random to me:
I intentionally left my computer running over night for several days to see if daily is launched at the specified time (3:15). But it was never executed at that time.

So finally it came to the conclusion, that StartCalendarInterval is still buggy. I have no solution to this problem. I personally will switch back to cron for scheduled jobs and hope they'll fix this in 10.4.4. Also cron has some features StartCalendarInterval has not. For example: you can run a job every Monday and Wednesday or Monday till Friday or only in January and March. But in launchd you can specify only one weekday/month/... Hope they'll improve that, too.

akirwan 01-03-2006 07:24 PM

I just noticed that my script ~/Library/LaunchAgents/ finally did run. It was set to run at 6:20PM and ran 2 days later at 2:00 am. I also noticed the odd times that the periodic scripts run, even when my computer is on they do not run at the specified times. My guess is the problem is what you said startcalendarintervals are still buggy in launchd as of 10.4.3. Hopefully Apple will fix this soon as I would really like to start using Launchd.

mttsmnw 01-04-2006 03:22 AM

I ran another google search for the problem and found this discussion at the apple-site:
http://discussions.apple.com/thread....sageID=1206929

It says there, a job isn't launched if the time of submission is less than 1 hours away from the start time. I tested this with a small shell script, which does nothing else than write the time and date of execution to a file. And indeed: it was executed (nearly) at the right time, if the time was at least 1h in the future from the time of submission. (It was not "exactly" on time, it was about 1 minute late ...)
I'll try to examine this behavior a little further ... perhaps I can find out what's going wrong.

tjj 01-04-2006 03:52 PM

see also this thread
 
right here

The timers that should trigger launchd jobs appear to be buggy (still) in 10.4.3.
I can as an aside recommend lingon (no affiliation:D) to edit/create launchd jobs.
If you make a copy of apple's daily job, I would expect you would have to rename it to something unique. Otherwise I have found that either lingon or launchctl complains that "...is already loaded".

mttsmnw 01-04-2006 05:32 PM

it seems the sleep-issue is the problem in my case. when I set up a job for 1h in the future it runs as expected. but if I set my computer to sleep for 10 minutes, it runs 10 minutes later than scheduled. that's definitly an annoying bug. I hope they'll fix this soon, I use a powerbook and need to put it to sleep many times during the day. So I'm back with cron till the next update.
btw: I already used lingon, but switched back to plist-editing and launchctl to investigate this bug (and to be sure it wasn't lingons fault, but it wasn't).


All times are GMT -5. The time now is 05:28 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.