summaryrefslogtreecommitdiff
path: root/src/publisher.c
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-07-15 12:26:46 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2023-07-15 12:26:46 +0200
commit97e167da1bd01570562913d6e496241f6cdb246e (patch)
treea109c7b01b96b40bb8dfe5a7596651e419813f01 /src/publisher.c
parent3da360332b38ba50e2a03f4b9287bc916523e492 (diff)
Minor changes
Diffstat (limited to 'src/publisher.c')
-rw-r--r--src/publisher.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/publisher.c b/src/publisher.c
index 8764294..1416738 100644
--- a/src/publisher.c
+++ b/src/publisher.c
@@ -24,15 +24,30 @@ int main (int argc, char *argv [])
__logdir=argv[1];
__loginterval=atoi(argv[2]);
+
+ //----- Start publisher
DIR *dr = opendir(__logdir);
struct dirent *de; // Pointer for directory entry
- for(int i=0;i<0;i++){
+ for(int i=0;i<=0;i++){
int interval=INTERVAL(__loginterval);
int interval_next=INTERVAL_NEXT(__loginterval);
while ((de = readdir(dr)) != NULL){
if(strcmp(de->d_name,".") && strcmp(de->d_name,"..")){
char *client=de->d_name;
- printf("aa%s\n",client);
+ char logfile[255];
+ char logfile_next[255];
+ sprintf(logfile,"%s/%s/%ld",__logdir,client,interval);
+ sprintf(logfile_next,"%s/%s/%ld",__logdir,client,interval_next);
+ // As long as next logfile is not available, we should wait
+ // for sending the current one
+ printf("Waiting for %s...%s\n",client,logfile_next);
+ while(!FILE_EXISTS(logfile_next)){
+ sleep(1);
+ }
+ // Send current one
+ if(FILE_EXISTS(logfile)){
+ printf("Sending....\n");
+ }
}
}
}