Here's a tool to launch any command without adding its pid to the member file of the group.
Simply type in a shell "./clauncher father/son command" and the pid of command will be added to the file /config/res_groups/father/son/member #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #define STATS_NAME_LENGTH 1024 #define RGCS "/config/res_groups" extern char **environ; void usage() { printf("Usage: clauncher group1/group2/group3 command\n"); } int main(int argc,char* argv[]) { pid_t pid; int i,status,nchar; char* command[argc-1],line[10]; char members[STATS_NAME_LENGTH]; FILE* f; if (argc < 3) { printf("Too few arguments\n\n"); usage(); return 1; } for (i=2;i<argc;i++) { command[i-2] = argv[i]; } command[argc-2] = NULL; if (fork()) { wait(&status); } else { sprintf(members,"%s/%s/members",RGCS,argv[1]); f = fopen(members,"a"); if (f == NULL) { printf("can't open file: %s\n",members); return 1; } sprintf(line,"%d",getpid()); if (strlen(line) != fprintf(f,"%s",line)) { printf("could not write to file: %s\n",members); return 1; } if (fclose(f)) { perror("can't close file"); return 1; } execvp(argv[2],command); perror(argv[2]); } return 0; } juanan _______________________________________________ ckrm-tech mailing list https://lists.sourceforge.net/lists/listinfo/ckrm-tech