[squid-users] redirect_program does not finish

From: Zé Luís <zeluis@dont-contact.us>
Date: Thu, 18 Jul 2002 10:49:50 -0300

Hi everybody

I have this program that is executed in redirect_program it of squid.
Redirect_children is 5
As he can be seen I do not know I eat to make to stop up it when squid
makes reconfigure/shutdown/restart/stop. This makes with that after a
time it has many processes running.
Which code would have that to insert below in the program so that it
finished when squid to stop? (signal)

Thanks a lot

/* ****************** */
/* program redirect.c */
/* Begin of program */

#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <regex.h>
#include <sys/signal.h>

int main(int argc, char *argv[])
{
     int i = 0;
     int j;
     char line[BUFSIZ];
     char url[256];
     char method[64];
     char ident[256];
     char src_address[256];
     FILE *urlfile;

     FILE *output_file;
     char slog[256];
     char stemp[256];
     char slinha[256];
     char sprogram[256];
     int i1 = 0;
     int i2 = 0;
     int i3 = 0;
     char s_url_retorno[256];
     char s_url_comp[256];
     char s_url_p[256];
     char s_ip[256];
     char s_logout_p[256];

     for ( ;; ) {

         while((fgets(line, BUFSIZ, stdin) != NULL)) {
             sscanf(line, "%255s %255s %255s %63s", url, src_address,
ident, method);

            i1 = strlen(src_address);
            i2 = strlen(ident);

            strcpy(s_url_comp,"http://192.168.1.200/my_url");
            strcpy(s_logout_p,url);

            if((strcmp(s_logout_p,"logout") == 0 ) ||
               (strcmp(s_url_comp,url) == 0 ) ) {
               strcpy(sprogram, "/aplicati/squid/some_action ");
               strcat(sprogram, src_address);
               strcat(sprogram, " ");
                 strcat(sprogram, ident);
               strcat(sprogram, " ");
                 strcat(sprogram, url);
               strcat(sprogram, " ");
                 strcat(sprogram, method);
                  system(sprogram);
            }
            else {
               printf("\n");
               fflush(stdout);
            }
        }
     }
     exit(0);
}

/* ****************** */
/* End of program */
Received on Thu Jul 18 2002 - 07:52:08 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:09:17 MST