Преглед на файлове

DATA_DIR beim Daemon Start erstellen

Christian Kahlau преди 3 години
родител
ревизия
c66e5a587c
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6 0
      src/index.ts

+ 6 - 0
src/index.ts

@@ -47,7 +47,13 @@ log.info('[INFO] Starting Monitoring Deamon, pid:', process.pid);
   process.on('SIGABRT', exitGracefully);
   process.on('SIGQUIT', exitGracefully);
   process.on('SIGTERM', exitGracefully);
+
   try {
+    if (!fs.existsSync(DATA_DIR)) {
+      console.info('[INFO] DATA_DIR', DATA_DIR, 'does not exist - creating now ...');
+      await fsp.mkdir(DATA_DIR);
+    }
+
     intervalHdl = setInterval(async () => {
       const now = moment();
       const time = now.format(TIMESTAMP_FORMAT);