From d062d61634c28260c10a73b9fd7a9cf4514af3ae Mon Sep 17 00:00:00 2001 From: thib Date: Tue, 29 May 2001 19:27:55 +0000 Subject: [PATCH] added fcron's option -m --- config.h.in | 6 +++++- database.c | 16 ++++++++-------- fcron.h | 3 ++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/config.h.in b/config.h.in index 478f925..6e69dc6 100644 --- a/config.h.in +++ b/config.h.in @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: config.h.in,v 1.28 2001-05-28 18:51:24 thib Exp $ */ + /* $Id: config.h.in,v 1.29 2001-05-29 19:32:45 thib Exp $ */ /* *********************************************************** */ @@ -59,6 +59,10 @@ * added to serial queue each time it has to grow * up */ +#define SERIAL_MAX_RUNNING 1 /* fcron will run (by default) no more than this + * number of serial job simultaneously. + * (this may be overridden by fcron option -m */ + #define LAVG_QUEUE_MAX 30 /* if lavg queue contains this number of entries, * the next lavg job to be executed will be run * before a new lavg job is added */ diff --git a/database.c b/database.c index b5bebd8..63134ba 100644 --- a/database.c +++ b/database.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: database.c,v 1.52 2001-05-24 19:59:47 thib Exp $ */ + /* $Id: database.c,v 1.53 2001-05-29 19:32:37 thib Exp $ */ #include "fcron.h" #include "database.h" @@ -80,7 +80,7 @@ run_normal_job(CL *line) run_queue_job(line); } else { - warn(" process already running: %s %s", + warn(" process already running: %s's %s", line->cl_file->cf_user, line->cl_shell ); @@ -115,8 +115,8 @@ run_serial_job(void) /* debug("running next serial job"); */ /* // */ -/* debug("num: %d running:%d index:%d", serial_num, serial_running, */ -/* serial_array_index); */ + debug("num: %d running:%d index:%d", serial_num, serial_running, + serial_array_index); if ( serial_num != 0 ) { run_queue_job(serial_array[serial_array_index]); serial_array[serial_array_index] = NULL; @@ -238,7 +238,7 @@ add_serial_job(CL *line) return; } -/* debug("inserting in serial queue %s", line->cl_shell); */ + debug("inserting in serial queue %s", line->cl_shell); if ( serial_num >= serial_array_size ) { if ( serial_num >= SERIAL_QUEUE_MAX ) @@ -393,12 +393,12 @@ wait_chld(void) if ( is_serial_once(line->cl_option) ) { clear_serial_once(line->cl_option); - if ( --serial_running <= 0 ) + if ( --serial_running < serial_max_running ) run_serial_job(); } else if ( is_serial(line->cl_option) && ! is_lavg(line->cl_option) ) { - if (--serial_running <= 0) + if (--serial_running < serial_max_running) run_serial_job(); } else if ( is_lavg(line->cl_option) && @@ -1154,7 +1154,7 @@ check_lavg(time_t lim) i = 0; while ( i < lavg_num ) { /* check if the line should be executed */ - if ( lavg_serial_running > 0 && + if ( lavg_serial_running >= serial_max_running && is_serial(lavg_array[i].l_line->cl_option) ) { i++; continue; diff --git a/fcron.h b/fcron.h index fe5ffa9..6c67b69 100644 --- a/fcron.h +++ b/fcron.h @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcron.h,v 1.22 2001-05-17 00:57:25 thib Exp $ */ + /* $Id: fcron.h,v 1.23 2001-05-29 19:27:55 thib Exp $ */ #ifndef __FCRON_H__ #define __FCRON_H__ @@ -70,6 +70,7 @@ extern short int serial_array_size; extern short int serial_array_index; extern short int serial_num; extern short int serial_running; +extern short int serial_max_running; extern struct exe *exe_array; extern short int exe_array_size; extern short int exe_num; -- 2.40.0