Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

DominikHoffmann

macrumors 6502a
Original poster
Jan 15, 2007
552
633
Indiana
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?
 
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?

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
 
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.
 
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.
 
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.
 
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... :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.