5 comments

[ 4.6 ms ] story [ 26.0 ms ] thread
Quoting the answer with 1 upvote:

> Experientially, there is a 999 character truncation per line on all of my Ubuntu machines, although I have not yet found any related explanatory documentation.

> I've tested on Ubuntu 10.04, 12.04, and 14.04, and the 999 character count is started at the first non-whitespace character past the schedule.

This fantastic. Indeed, this is completely undocumented.

Running `grep -R 1000 .` on `apt-get-source cron` turns up:

        ./cron-3.0pl1/cron.h:#define	MAX_COMMAND	1000	/* max length of internally generated cmd */
Further grepping for MAX_COMMAND gives you this gem:

        /* Everything up to the next \n or EOF is part of the command...
         * too bad we don't know in advance how long it will be, since we
         * need to malloc a string for it... so, we limit it to MAX_COMMAND.
         * XXX - should use realloc().
         */ 
        ch = get_string(cmd, MAX_COMMAND, file, "\n");

XXX - should use realloc().

Really?

Is there a good reason to have a 999 length command there though? Put it in a script if it has that much going on and then call the script instead..

This should be documented but I don't see the big deal.

Until your embedded device running cron, say your pacemaker or "smart" fire alarm, chops off a part from the yearly `0 0 1 1 * very-long-command-to-stop-service; start-service`.
Again.. just seems like bad practice.

  cron
  ----

  0 0 1 1 * script.sh

  script.sh
  ---------

  #!/bin/bash
  very-long-command-to-stop-service
  start-service