summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-07-15 20:51:45 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2023-07-15 20:51:45 +0200
commit087253ca04b79b3d13d8df62ba3c1ed3a3a99470 (patch)
treea718a533b33a92b31a384670e12f04e593d1812e
parent3ed96f9c9a813130f26cd1187fc439440067e5cc (diff)
Minor changes
-rw-r--r--.gitignore3
-rw-r--r--Makefile5
-rw-r--r--src/logger.c2
-rw-r--r--src/publisher.c2
4 files changed, 7 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 4df076a..ea247f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@
# Caches
/logs
-/data \ No newline at end of file
+/data
+/pid \ No newline at end of file
diff --git a/Makefile b/Makefile
index b08b9cd..e17d8d7 100644
--- a/Makefile
+++ b/Makefile
@@ -15,8 +15,9 @@ logger: src/logger.c src/utils.c
$(CC) $^ -o $@
publish: publisher logger
- ./logger $(LOGGERS_DIR) 587 $(LOG_INTERVAL) &
- ./publisher $(LOGGERS_DIR) $(LOG_INTERVAL) $(SUBSCRIBER_ADDR) $(ZMQ_PORT) $(KEY) &
+ rm -f pid
+ ./logger $(LOGGERS_DIR) 587 $(LOG_INTERVAL) &> $(LOGGERS_DIR)/587.log & echo $$! >> pid
+ ./publisher $(LOGGERS_DIR) $(LOG_INTERVAL) $(SUBSCRIBER_ADDR) $(ZMQ_PORT) $(KEY)
subscribe: subscriber
./subscriber $(ZMQ_PORT) $(SUBSCRIBER_DIR)
diff --git a/src/logger.c b/src/logger.c
index 0a3278e..a698a0d 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -70,7 +70,7 @@ int main (int argc, char *argv [])
fprintf(logptr,"%ld,%d\n",TIMESTAMP(),power);
fseek(regptr,0,SEEK_SET);
sleep(1);
- printf("Tick\n");
+ printf("Tick\n"); fflush(stdout);
}
fclose(logptr);
}
diff --git a/src/publisher.c b/src/publisher.c
index e216232..7c401c4 100644
--- a/src/publisher.c
+++ b/src/publisher.c
@@ -62,7 +62,7 @@ int main (int argc, char *argv [])
// Send current one
if(FILE_EXISTS(logfile)){
publish(publisher,logfile,client,interval);
- //remove(logfile);
+ remove(logfile);
}
}
}