I have a client - server application written in C. It's a basic application where client does an update request to server. If there are updates available, an archive file is sent to client. Further, the client unpack it, and run a specific bash script from that unpacked archive. That's the summary. I'll present bellow the C function that does the update on the client side:
void executeUpdates(char *path) {
char command[100];
char *tmp;
strcpy(command, "tar xzf ");
tmp = mystrcat(command, path);
mystrcat(tmp, " -C /netnfork/updates/");
system(command); //up to this point, I created the extract command and executed it.
command[0] = '\0';
path[strlen(path) - 7] = '\0';
strcpy(command, path);
strcat(command, "/update.sh");
system(command);// up to this point, I created the command to run the update script and ran it.
}
The problem is as follows:
Problem: In the first updates when I put in update.sh
script some simple commands (by simple I mean a few), it works well. When I put in this script some commands that do archive extraction, compilation with ./configure
, make
, make install
, the script hangs in a specific point forever.
Specifically, in the update archive, I have six tar.bz archives that I need to extract and install. It works well for first 5 archives, but when script arrive to the point of the sixth tar.bz installation, it hangs on. If I run this script directly from terminal, it runs well, without any problem.
Question: Do anyone have some thoughts on solving this issue?
N.B. If you need more specific details or the script content, just tell me.
N.B1. I run the update C program as root.