Launchd

Discussion in 'macOS' started by grapes911, Jul 8, 2005.

  1. grapes911 Moderator emeritus

    grapes911

    Joined:
    Jul 28, 2003
    Location:
    Citizens Bank Park
    #1
    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?
     
  2. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #2
    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.
     
  3. grapes911 thread starter Moderator emeritus

    grapes911

    Joined:
    Jul 28, 2003
    Location:
    Citizens Bank Park
  4. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
  5. Flying Llama macrumors 6502a

    Flying Llama

    Joined:
    Aug 4, 2004
    Location:
    Los Angeles
    #5
    So no more cron? So should we stop calling them cron scripts and start calling them launchd scripts? Aww man...

    llama
     
  6. iMeowbot macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #6
    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).
     
  7. grapes911 thread starter Moderator emeritus

    grapes911

    Joined:
    Jul 28, 2003
    Location:
    Citizens Bank Park
    #7
    I get this (below). Are you telling me that if I put jobs in here they will still run?
     

    Attached Files:

  8. Flying Llama macrumors 6502a

    Flying Llama

    Joined:
    Aug 4, 2004
    Location:
    Los Angeles
    #8
    Few, good to hear!

    llama
     
  9. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #9
    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.
     
  10. freiheit macrumors 6502a

    Joined:
    Jul 20, 2004
    Location:
    California
  11. grapes911 thread starter Moderator emeritus

    grapes911

    Joined:
    Jul 28, 2003
    Location:
    Citizens Bank Park
    #11
  12. Flying Llama macrumors 6502a

    Flying Llama

    Joined:
    Aug 4, 2004
    Location:
    Los Angeles
    #12
    So what would be the advantage of switching to launchd?
     
  13. iMeowbot macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #13
    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.
     
  14. grapes911 thread starter Moderator emeritus

    grapes911

    Joined:
    Jul 28, 2003
    Location:
    Citizens Bank Park
    #14
    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 )


    Launchd takes the place of every daemon. Here is a good article that describes launchd and its advantages.
     
  15. freiheit macrumors 6502a

    Joined:
    Jul 20, 2004
    Location:
    California
    #15
    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.
     
  16. Flying Llama macrumors 6502a

    Flying Llama

    Joined:
    Aug 4, 2004
    Location:
    Los Angeles
    #16
    Ah yes, launchd was definately a smart move, good job Apple!
    And thanks freiheit and grapes911 for the help.

    llama :)
     

Share This Page