Re: Forking - a few queries

From: George Greer (greerga@circlemud.org)
Date: 01/10/00


On Mon, 10 Jan 2000, Julian Buckley wrote:

>Now, the code simply scans the syslog.* files (syslog.1, syslog.2, etc)
>for occurrences of 'SYSERR' and counts the number of lines
>accordingly...

void syserr_check(struct char_data *ch)
{
  int count;
  FILE *pipeme;

  pipeme = popen("grep SYSERR ../log/syslog.* | wc -l", "r");
  fscanf(pipeme, "%d\n", &count);
  pclose(pipeme);

>  if (count) {
>    sprintf(buf, "\007\007\007\007&rThere are %d SYSERRs in the system
>logs requiring attention.&n\r\n", count);
>    send_to_char(buf, ch);
>  }
>}

Not sure how fast it'll run, but shouldn't be too bad since only one
integer is produced.

--
George Greer            | CircleMUD Snippets
greerga@circlemud.org   | http://developer.circlemud.org/snippets/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT