Launchd

grapes911

Moderator emeritus
Original poster
Jul 28, 2003
6,943
3
Citizens Bank Park
I'm been a big fan of making custom cron files for years in both Linux and OS X. As many of you know, Tiger replaced cron and some other things with launchd. I can't figure out how to add/edit/delete scheduled events. I've googled launchd and I haven't found a good manual on launchd that I've got to work. Even 'man launchd' sucks. Anyone have any knowledge on this?
 

wrldwzrd89

macrumors G5
Jun 6, 2003
12,107
73
Solon, OH
Have you tried the info command yet? Maybe "info launchd" will give some better advice. Sometimes I've found the info pages better than the man pages for a command.
 

iMeowbot

macrumors G3
Aug 30, 2003
8,643
0
Flying Llama said:
So no more cron? So should we stop calling them cron scripts and start calling them launchd scripts? Aww man...
cron is still there!

crontab -e and vi don't get along, though. Set VISUAL to something else (pico is good enough if you don't feel like installing something better).
 

grapes911

Moderator emeritus
Original poster
Jul 28, 2003
6,943
3
Citizens Bank Park
iMeowbot said:
cron is still there!

crontab -e and vi don't get along, though. Set VISUAL to something else (pico is good enough if you don't feel like installing something better).
I get this (below). Are you telling me that if I put jobs in here they will still run?
 

Attachments

Flying Llama

macrumors 6502a
Aug 4, 2004
737
0
Los Angeles
iMeowbot said:
cron is still there!

crontab -e and vi don't get along, though. Set VISUAL to something else (pico is good enough if you don't feel like installing something better).
Few, good to hear!

llama
 

Westside guy

macrumors 603
Oct 15, 2003
5,427
2,246
The soggy side of the Pacific NW
It's probably worth noting that launchd is still somewhat broken (as of 10.4.1). I'm too lazy to go find the references, but poke around some of Apple's developer docs and you'll find a number of mentions of this fact.
 

iMeowbot

macrumors G3
Aug 30, 2003
8,643
0
grapes911 said:
I get this (below). Are you telling me that if I put jobs in here they will still run?
They should.

You can verify that the cron daemon is running with ps ax | grep cron

To check that it really works, try adding this line to your crontab:

* * * * * /usr/bin/say Meow

... that should cause your Mac to meow once a minute.
 

grapes911

Moderator emeritus
Original poster
Jul 28, 2003
6,943
3
Citizens Bank Park
iMeowbot said:
They should.

You can verify that the cron daemon is running with ps ax | grep cron

To check that it really works, try adding this line to your crontab:

* * * * * /usr/bin/say Meow

... that should cause your Mac to meow once a minute.
Yup, still works. I tested it out after you said it was still there. I got it to work. I still want to learn Launchd though. (call me a geek :p )


Flying Llama said:
So what would be the advantage of switching to launchd?
Launchd takes the place of every daemon. Here is a good article that describes launchd and its advantages.
 

freiheit

macrumors 6502a
Jul 20, 2004
644
90
California
Flying Llama said:
So what would be the advantage of switching to launchd?
For one-shot tasks like running a timed event, probably not much. But the way launchd was explained to me (by a developer whom I trust enough to paraphrase :)) launchd provides system-level services which can be started, stopped, communicated with while running, etc. Something similar to services in Windows 2K/XP where (for example) you can run VNC as a service so you can login remotely even when no user is currently logged into the system. Launchd as I understood it is a similar thing but done UNIX-like.

And yeah, I could be way off base here, but that's what I understood it to mean.
 

Flying Llama

macrumors 6502a
Aug 4, 2004
737
0
Los Angeles
freiheit said:
For one-shot tasks like running a timed event, probably not much. But the way launchd was explained to me (by a developer whom I trust enough to paraphrase :)) launchd provides system-level services which can be started, stopped, communicated with while running, etc. Something similar to services in Windows 2K/XP where (for example) you can run VNC as a service so you can login remotely even when no user is currently logged into the system. Launchd as I understood it is a similar thing but done UNIX-like.

And yeah, I could be way off base here, but that's what I understood it to mean.
Ah yes, launchd was definately a smart move, good job Apple!
And thanks freiheit and grapes911 for the help.

llama :)