Where is the crontab located in ML?

Discussion in 'OS X Mountain Lion (10.8)' started by DominikHoffmann, Oct 29, 2013.

  1. DominikHoffmann macrumors regular

    DominikHoffmann

    Joined:
    Jan 15, 2007
    Location:
    Commonwealth of Virginia
    #1
    In earlier versions of Mac OS X the crontab was at /etc/crontab. However, as far, as I can tell, no longer. Where did it move to?
     
  2. MacUser2525 macrumors 68000

    MacUser2525

    Joined:
    Mar 17, 2007
    Location:
    Canada
    #2
    Looks like /usr/bin is the spot it now resides.

    Code:
    $  locate crontab |grep bin
    /Volumes/Mavericks_Clone/usr/bin/crontab
    /Volumes/Mavericks_GM/usr/bin/crontab
    /usr/bin/crontab
    
     
  3. DominikHoffmann thread starter macrumors regular

    DominikHoffmann

    Joined:
    Jan 15, 2007
    Location:
    Commonwealth of Virginia
    #3
    Isn’t that the location of the cron code?
     
  4. DominikHoffmann thread starter macrumors regular

    DominikHoffmann

    Joined:
    Jan 15, 2007
    Location:
    Commonwealth of Virginia
    #4
    I found a reference to
    Code:
    /usr/lib/cron/
    That is actually a symlink to
    Code:
    /var/at/
    where I found my crontab at
    Code:
    /var/at/tabs/username
    I know that you’re not supposed to edit the file directly. However, if you want to restore a crontab from backup, you have to know, where to find it. In my research I have come across references to Mountain Lion deleting
    Code:
    /etc/crontab
    although it wasn't clear, whether this happens on every reboot or whether it does only when Mountain Lion is installed on top of an earlier version of the OS.
     
  5. Tonsko macrumors 6502

    Tonsko

    Joined:
    Aug 19, 2010
    #5
    Are you just trying to schedule stuff?

    At risk of teaching you to suck eggs, ML doesn't use that to schedule tasks any more; it uses launchctl and plist files.

    Apologies if that's not what you're after.
     
  6. DominikHoffmann thread starter macrumors regular

    DominikHoffmann

    Joined:
    Jan 15, 2007
    Location:
    Commonwealth of Virginia
    #6
    Apple urges people to switch from using cron to using launchd with Mountain Lion. However, cron was alive and well with ML—I ran several scripts to run nightly for cleaning up my Downloads folder and such.

    I haven’t yet ascertained, whether this is still true with Mavericks, but even there, crontab is installed in /usr/bin/. Also,
    Code:
    crontab -e
    works, and so do the other crontab options. Whether it actually runs as scheduled I will learn tonight.

    Cron is so much easier to program than launchd. That’s the real reason.
     
  7. Tonsko macrumors 6502

    Tonsko

    Joined:
    Aug 19, 2010
    #7
    Heh, oops! I believed the hype when I wanted to schedule something. So I wrestled with launchd. Got it working, but it wasn't straightforward... :)
     

Share This Page