diff --git a/mbtk/mbtk_servicesd/main.c b/mbtk/mbtk_servicesd/main.c
new file mode 100755
index 0000000..c832588
--- /dev/null
+++ b/mbtk/mbtk_servicesd/main.c
@@ -0,0 +1,108 @@
+/*
+*    main.c
+*
+*    MBTK important service support.
+*
+*/
+/******************************************************************************
+
+                          EDIT HISTORY FOR FILE
+
+  WHEN        WHO       WHAT,WHERE,WHY
+--------    --------    -------------------------------------------------------
+2024/6/12     LiuBin      Initial version
+
+******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include "mbtk_type.h"
+#include "mbtk_log.h"
+#include "instance_info.h"
+
+#define MBTK_SERVICES_PID_FILE "/var/run/mbtk_servicesd.pid"
+#define MBTK_SERVICES_CONF_FILE "/etc/mbtk_servicesd.conf"
+
+extern int instance_info_size;
+extern instance_info_t instance_infos[];
+int ins_monitor_service_start();
+
+static void config_parse(const char *conf_file)
+{
+    FILE *fptr = fopen(conf_file, "r");
+    if(fptr != NULL) {
+        char line[1024] = {0};
+        bool respawn_process = FALSE;
+        while(fgets(line, sizeof(line), fptr) != NULL && strlen(line) > 0) {
+            if(str_startwith(line, "#")) {
+                memset(line, 0, sizeof(line));
+                continue;
+            }
+
+            if(!respawn_process && str_startwith(line, "respawn_start")) {
+                respawn_process = TRUE;
+                memset(line, 0, sizeof(line));
+                continue;
+            } else if(respawn_process && str_startwith(line, "respawn_end")) {
+                respawn_process = FALSE;
+                memset(line, 0, sizeof(line));
+                continue;
+            }
+
+            char *ptr = line + strlen(line) - 1;
+            while(ptr >= line && (*ptr == '\r' || *ptr == '\n' || *ptr == ' ')) {
+                *ptr-- = '\0';
+            }
+
+            if(ptr < line) { // Empty line
+                memset(line, 0, sizeof(line));
+                continue;
+            }
+
+            if(respawn_process && instance_info_size < INSTANCE_NUM_MAX) {
+                ptr = strstr(line, ":");
+                if(ptr) {
+                    *ptr++ = '\0';
+                    memcpy(instance_infos[instance_info_size].ins_name, line, strlen(line));
+                    memcpy(instance_infos[instance_info_size].ins_cmd, ptr, strlen(ptr));
+                    instance_infos[instance_info_size].ins_pid = -1;
+                    instance_info_size++;
+                }
+            }
+
+            memset(line, 0, sizeof(line));
+        }
+        fclose(fptr);
+    }
+}
+
+int main(int argc, char *argv[])
+{
+    mbtk_log_init("radio", "MBTK_SERVICES");
+
+#ifdef MBTK_DUMP_SUPPORT
+    mbtk_debug_open(NULL, TRUE);
+#endif
+
+    if(app_already_running(MBTK_SERVICES_PID_FILE)) {
+        LOGW("daemon already running.");
+        exit(1);
+    }
+
+    config_parse(MBTK_SERVICES_CONF_FILE);
+
+    // Start services.
+    if(ins_monitor_service_start()) {
+        LOGW("ins_monitor_service_start() fail.");
+    }
+
+    while(1) {
+        sleep(24 * 60 * 60);
+    }
+
+    return 0;
+}
+
