Made mbtask more relaxed

This commit is contained in:
Michiel Broek 2001-12-23 14:15:58 +00:00
parent 3969db7a22
commit 2ce85589e4
4 changed files with 350 additions and 331 deletions

View File

@ -4350,12 +4350,15 @@ v0.33.19 26-Oct-2001
option is set for the remote node in the setup.
The hydra driver now sends 8.3 mangled filenames and long
filenames as specified in the specs.
Corrected the location of the modem lockfile on FreeBSD.
mbtask:
Changed to handle the External Doors flag in the lastcaller
information.
On new systems, ~/etc/config.data and ~/etc/task.data are
created with mode 0640.
Starting utilities is now more relaxed using a 3 seconds
pause timer. Fixed some potential Sparc problems.
mbmon:
Changed the lastcaller screen to display the External Door

View File

@ -47,6 +47,7 @@
*/
#define MAXTASKS 10
#define SLOWRUN 20
#define PAUSETIME 3
#define TMPNAME "TMP."
#define LCKNAME "LOCKTASK"
#define ICMP_BASEHDR_LEN 8
@ -101,6 +102,8 @@ int pingnr = 1; /* Ping #, 1 or 2 */
int pingresult[2]; /* Ping results */
char pingaddress[41]; /* Ping current address */
int masterinit = FALSE; /* Master init needed */
int ptimer = PAUSETIME; /* Pause timer */
/*
@ -452,7 +455,7 @@ void load_taskcfg(void)
/*
* Launch an external program in the background.
* On success add it to the tasklist and return
* the pid.
* the pid. Set the pause timer.
*/
pid_t launch(char *cmd, char *opts, char *name, int tasktype)
{
@ -531,6 +534,8 @@ pid_t launch(char *cmd, char *opts, char *name, int tasktype)
}
}
ptimer = PAUSETIME;
if (opts)
tasklog('+', "Launch: task %d \"%s %s\" success, pid=%d", i, cmd, opts, pid);
else
@ -580,6 +585,7 @@ int checktasks(int onsig)
task[i].running = FALSE;
if (task[i].tasktype == CALL_POTS || task[i].tasktype == CALL_ISDN || task[i].tasktype == CALL_IP)
do_outstat = TRUE;
ptimer = PAUSETIME;
}
if (first && task[i].rc) {
@ -1037,7 +1043,7 @@ void scheduler(void)
{
struct passwd *pw;
int running = 0, rc, rlen;
int LOADhi = FALSE, oldmin = 70, olddo = 70;
static int LOADhi = FALSE, oldmin = 70, olddo = 70, oldsec = 70;
char *cmd = NULL;
static char doing[32], buf[2048];
time_t now;
@ -1053,11 +1059,11 @@ void scheduler(void)
* Registrate this server for mbmon in slot 0.
*/
reginfo[0].pid = getpid();
sprintf(reginfo[0].tty, "-");
sprintf(reginfo[0].uname, "mbse");
sprintf(reginfo[0].prg, "mbtask");
sprintf(reginfo[0].city, "localhost");
sprintf(reginfo[0].doing, "Start");
strcpy(reginfo[0].tty, "-");
strcpy(reginfo[0].uname, "mbse");
strcpy(reginfo[0].prg, "mbtask");
strcpy(reginfo[0].city, "localhost");
strcpy(reginfo[0].doing, "Start");
reginfo[0].started = time(NULL);
Processing = TRUE;
@ -1136,7 +1142,7 @@ void scheduler(void)
check_sema();
/*
* Check the systems load average.
* Check the systems load average. FIXME: doesn't work in FreeBSD !!!
*/
if ((fp = fopen((char *)"/proc/loadavg", "r"))) {
if (fscanf(fp, "%f %f %f", &lavg1, &lavg2, &lavg3) == 3) {
@ -1196,6 +1202,18 @@ void scheduler(void)
if (s_bbsopen && !UPSalarm && !LOADhi) {
/*
* Check Pause Timer, make sure it's only checked
* once each second.
*/
if (tm->tm_sec != oldsec) {
oldsec = tm->tm_sec;
if (ptimer) {
ptimer--;
tasklog('t', "Set ptimer to %d", ptimer);
}
}
if (!Processing) {
tasklog('+', "Resuming normal operations");
Processing = TRUE;
@ -1204,19 +1222,19 @@ void scheduler(void)
/*
* Here we run all normal operations.
*/
if (s_mailout && (!runtasktype(MBFIDO))) {
if (s_mailout && (!ptimer) && (!runtasktype(MBFIDO))) {
launch(TCFG.cmd_mailout, NULL, (char *)"mailout", MBFIDO);
running = checktasks(0);
s_mailout = FALSE;
}
if (s_mailin && (!runtasktype(MBFIDO))) {
if (s_mailin && (!ptimer) && (!runtasktype(MBFIDO))) {
launch(TCFG.cmd_mailin, NULL, (char *)"mailin", MBFIDO);
running = checktasks(0);
s_mailin = FALSE;
}
if (s_newnews && (!runtasktype(MBFIDO))) {
if (s_newnews && (!ptimer) && (!runtasktype(MBFIDO))) {
launch(TCFG.cmd_newnews, NULL, (char *)"newnews", MBFIDO);
running = checktasks(0);
s_newnews = FALSE;
@ -1228,7 +1246,7 @@ void scheduler(void)
* new lists. If more then one compiler is defined,
* start them in parallel.
*/
if (s_index && (!running)) {
if (s_index && (!ptimer) && (!running)) {
if (strlen(TCFG.cmd_mbindex1))
launch(TCFG.cmd_mbindex1, NULL, (char *)"compiler 1", MBINDEX);
if (strlen(TCFG.cmd_mbindex2))
@ -1243,7 +1261,7 @@ void scheduler(void)
* Linking messages is also only done when there is
* nothing else to do.
*/
if (s_msglink && (!running)) {
if (s_msglink && (!ptimer) && (!running)) {
launch(TCFG.cmd_msglink, NULL, (char *)"msglink", MBFIDO);
running = checktasks(0);
s_msglink = FALSE;
@ -1252,7 +1270,7 @@ void scheduler(void)
/*
* Creating filerequest indexes.
*/
if (s_reqindex && (!running)) {
if (s_reqindex && (!ptimer) && (!running)) {
launch(TCFG.cmd_reqindex, NULL, (char *)"reqindex", MBFILE);
running = checktasks(0);
s_reqindex = FALSE;

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: mbtask/outstat.c
* Purpose ...............: Scan mail outbound status
* Last modification date : 08-Jul-2001
* $Id$
* Purpose ...............: mbtask - Scan mail outbound status
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -157,7 +156,7 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
(*tmp)->diflags = 0L;
(*tmp)->ipflags = 0L;
}
time(&((*tmp)->time));
(*tmp)->time = time(NULL);
(*tmp)->size = 0L;
}
@ -179,7 +178,7 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
if (stat(fname,&st) != 0) {
tasklog('?', "$Can't stat %s", fname);
st.st_size = 0L;
(void)time(&st.st_mtime);
st.st_mtime = time(NULL);
}
/*
@ -211,12 +210,12 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
* is losing mail or files.
*/
st.st_size = 0L;
(void)time(&st.st_mtime);
st.st_mtime = time(NULL);
}
} else {
if (stat(p, &st) != 0) {
st.st_size = 0L;
(void)time(&st.st_mtime);
st.st_mtime = time(NULL);
}
}
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: mbtask/taskutil.c
* $Id$
* Purpose ...............: MBSE BBS Task Manager, utilities
* Last modification date : 06-Jul-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -396,7 +395,7 @@ char *dayname(void)
struct tm *ptm;
static char buf[3];
(void)time(&tt);
tt = time(NULL);
ptm = localtime(&tt);
sprintf(buf, "%s", dow[ptm->tm_wday]);