~ubuntu-branches/debian/sid/cron/sid

« back to all changes in this revision

Viewing changes to do_command.c

  • Committer: Package Import Robot
  • Author(s): Javier Fernández-Sanguino Peña, Christian Kastner
  • Date: 2011-09-09 23:25:35 UTC
  • Revision ID: package-import@ubuntu.com-20110909232535-2s9x4xbzm5b8vnzz
Tags: 3.0pl1-120
* do_command.c, cron.h, cron.8: Change the behaviour when logging the
  information of the child processes. A new loglevel (8) is introduced and
  documented in cron.8. The previous log format is kept unless the sysadmin
  choses to select this new option.   (Closes: 637295) 
* debian/examples/cron-stats.pl: Adjust the script with the
  changes introduced in the logging behaviour.
* cron.8: Fix minor formatting errors
* debian/cron.bug-script:
    - Report properly on the EDITOR variable
    - Report the permissions and contents of all relevant cron directories
* debian/changelog: Typo fixes and missing information
* crontab.5: 
    - Document limitations of the periods that can be defined in crontab
      syntax and provide workarounds (Closes: 640086)
    - Document limitation of the use of @reboot due to the definition
      of the boot sequence as suggested by Regid Ichira.
* debian/source/lintian-overrides: Add overrides file for lintian
  required because the maintainer name in debian/changelog and in
  debian/control do not match due to encoding.
[ Christian Kastner ]
* debian/control:
  - Fix broken Vcs-* URLs
* debian/NEWS: Remove previous spurious entry from 3.0pl1-110.

Show diffs side-by-side

added added

removed removed

Lines of Context:
259
259
                Debug(DPROC, ("[%d] grandchild process fork()'ed\n",
260
260
                              getpid()))
261
261
 
262
 
                /* write a log message.  we've waited this long to do it
 
262
                /* write a log message .  we've waited this long to do it
263
263
                 * because it was not until now that we knew the PID that
264
264
                 * the actual user command shell was going to get and the
265
265
                 * PID is part of the log message.
266
266
                 */
267
 
                if (log_level & CRON_LOG_JOBSTART) {
268
 
                        char logcmd[MAX_COMMAND + 8];
269
 
                        snprintf(logcmd, sizeof(logcmd), "[%d] %s", (int) getpid(), e->cmd);
270
 
                        char *x = mkprints((u_char *)logcmd, strlen(logcmd));
271
 
 
 
267
                if ( (log_level & CRON_LOG_JOBSTART) && ! (log_level & CRON_LOG_JOBPID)) {
 
268
                        char *x = mkprints((u_char *)e->cmd, strlen(e->cmd));
272
269
                        log_it(usernm, getpid(), "CMD", x);
273
270
                        free(x);
274
271
                }
275
 
 
276
 
                /* that's the last thing we'll log.  close the log files.
 
272
                /* nothing to log from now on. close the log files.
277
273
                 */
278
274
                log_close();
279
275
 
383
379
                break;
384
380
        default:
385
381
                /* parent process */
 
382
                /* write a log message if we want the parent and child
 
383
                 * PID values
 
384
                 */
 
385
                if ( (log_level & CRON_LOG_JOBSTART) && (log_level & CRON_LOG_JOBPID)) {
 
386
                        char logcmd[MAX_COMMAND + 8];
 
387
                        snprintf(logcmd, sizeof(logcmd), "[%d] %s", (int) job_pid, e->cmd);
 
388
                        char *x = mkprints((u_char *)logcmd, strlen(logcmd));
 
389
                        log_it(usernm, getpid(), "CMD", x);
 
390
                        free(x);
 
391
                }
386
392
                break;
387
393
        }
388
394
 
639
645
        fclose(tmpout);
640
646
 
641
647
        if (log_level & CRON_LOG_JOBEND) {
642
 
                char logcmd[MAX_COMMAND + 8];
643
 
                snprintf(logcmd, sizeof(logcmd), "[%d] %s", (int) job_pid, e->cmd);
644
 
                char *x = mkprints((u_char *)logcmd, strlen(logcmd));
645
 
 
 
648
                char *x;
 
649
                if (log_level & CRON_LOG_JOBPID) {
 
650
                        char logcmd[MAX_COMMAND + 8];
 
651
                        snprintf(logcmd, sizeof(logcmd), "[%d] %s", (int) job_pid, e->cmd);
 
652
                        x = mkprints((u_char *)logcmd, strlen(logcmd));
 
653
                } else {
 
654
                        x = mkprints((u_char *)e->cmd, strlen(e->cmd));
 
655
                }
646
656
                log_it(usernm, job_pid, "END", x);
647
657
                free(x);
648
658
        }