Crontab Trouble in 10.4

Posted:
in macOS edited January 2014
Hi all,



I wrote a script I'd like to run, and then pipe to mail, everyday at 6:00 PM. On a linux system I'd use crontab to nadle this with no trouble at all. I have tried doing that on my Mac but the job doesn't seem to run, even though I have tested it via the commandline manually.



Does the system not check crontab anymore?? Here are a couple of entries I have tried:



00 18 * * * root /Users/zeeple/projects/eve/eve.pl | mail [email protected]

*/1 * * * * root '/Users/zeeple/projects/eve/eve.pl | mail [email protected]'



The 00 18 would schedule it to run daily at 6:00 PM and the */1 would normally cause it to run every minute on a linux system. I threw that in as a test.





Thanks!

Zeeple.

Comments

  • Reply 1 of 12
    Yes, crontab is in fact disabled in 10.4, you can enable it if you'd really like to but it is being deprecated for a much better system, launchd. Check out /System/Library/LaunchDaemons
  • Reply 2 of 12
    To add to what I said before, launchd is Apple's new system that replaces init, watchdog, cron, at, (x)inetd, and rc. Like lookupd before it, launchd is Apple's super simple solution to a long standing *nix problem, launchd not only consolidates all of those services into one clean package, it also allows concurrent launching of services during boot, which is why Mac OS X 10.4 boots so damn fast Furthermore, launchd adds several new features such as queue folders, Watch paths, and chroot jails for processes. After showing it off to them, my Linux buddies have been so jealous, and one of them has spent a week unsuccessfully trying to get linux to boot processes non-linearly. Check out launchd, I think you'll like what you find
  • Reply 3 of 12
    zeeplezeeple Posts: 31member
    That sounds terrific akheron. I will definitely check it out. Any suggestions on a good quick tutorial for getting my littl perl script scheduled? It be great if osx had some gui for it. Otherwise, command line is cool too.
  • Reply 4 of 12
    lundylundy Posts: 4,466member
    Cron is deprecated, but it still works on my Tiger system and I don't remember doing anything special. I have a "update IP address" script running once every 10 minutes with cron with no problems.



    Did you use crontab to generate the cron file? They won't work if you just make them yourself.



    man crontab



    or on the chance that cron is reading the file but the actions somehow aren't getting executed, replace the second one with



    echo "crontab executed" >> dev/console
  • Reply 5 of 12
    a_greera_greer Posts: 4,594member
    Quote:

    Originally posted by akheron01

    To add to what I said before, launchd is Apple's new system that replaces init, watchdog, cron, at, (x)inetd, and rc. Like lookupd before it, launchd is Apple's super simple solution to a long standing *nix problem, launchd not only consolidates all of those services into one clean package, it also allows concurrent launching of services during boot, which is why Mac OS X 10.4 boots so damn fast Furthermore, launchd adds several new features such as queue folders, Watch paths, and chroot jails for processes. After showing it off to them, my Linux buddies have been so jealous, and one of them has spent a week unsuccessfully trying to get linux to boot processes non-linearly. Check out launchd, I think you'll like what you find



    WOW...is linux even working on a system like that?
  • Reply 6 of 12
    a_greera_greer Posts: 4,594member
  • Reply 7 of 12
    chuckerchucker Posts: 5,089member
    Quote:

    Originally posted by a_greer

    WOW...is linux even working on a system like that?



    Not quite, but init-ng at least replaces SysV Init with a more modern launchd-like asynchronous init system.



    FreeBSD has been working on porting launchd and might incorporate it in a future 6.x release.
  • Reply 8 of 12
    gene cleangene clean Posts: 3,481member
    Quote:

    Originally posted by a_greer

    WOW...is linux even working on a system like that?



    You can do this in Linux. You can edit the /etc/conf/rc file and change



    Quote:

    RC_PARALLEL_STARTUP="no"



    to



    Quote:

    RC_PARALLEL_STARTUP="yes"



    It's disabled by default. Not sure why.
  • Reply 9 of 12
    Quote:

    You can do this in Linux. You can edit the /etc/conf/rc file



    Really? My friend Jeff who is a Linux guru over at Dartmouth, was the one trying to get it to work and he installed init-ng as Chucker had suggested. The reason that failed to work was because of some incompatibility with his hardware and init-ng, if I recall correctly.
  • Reply 10 of 12
    Yeah, a quick Google always helps I found these links for those of you interested:



    Apple's launchd Developer Page

    AFP548 launchd Article -- Very good website, I got to hear Josh Wisenbaker of AFP548 talk at Macworld Boston last year about launchd

    All About launchd Items and how to make one for yourself -- MacGeekery, another great website.

    Some launchd Recipes -- Another from MacGeekery

    Streaming Quicktime launchd Video Tutorial

    Wikipedia Article -- Very thorough
  • Reply 11 of 12
    gene cleangene clean Posts: 3,481member
    Quote:

    Originally posted by akheron01

    Really? My friend Jeff who is a Linux guru over at Dartmouth, was the one trying to get it to work and he installed init-ng as Chucker had suggested. The reason that failed to work was because of some incompatibility with his hardware and init-ng, if I recall correctly.



    Yes, really. The problem is, not all kernel versions support this. I *believe* that init-ng was included in the latest kernel version 2.6.15. but I'm not 100% sure.
  • Reply 12 of 12
    wplatewplate Posts: 4member
    Quote:
    Originally Posted by akheron01 View Post


    Yes, crontab is in fact disabled in 10.4, you can enable it if you'd really like to but it is being deprecated for a much better system, launchd. Check out /System/Library/LaunchDaemons



    How to enable it? Every Google search I do seems to bring to posts like this that say to move to launchd instead, but never explain how to enable cron under 10.4.



    Can you illuminate? Thanks.
Sign In or Register to comment.