diff --git a/mbtk/libgsw_lib/gsw_sys_interface.c b/mbtk/libgsw_lib/gsw_sys_interface.c
index 21656e3..e674fd6 100755
--- a/mbtk/libgsw_lib/gsw_sys_interface.c
+++ b/mbtk/libgsw_lib/gsw_sys_interface.c
@@ -6,206 +6,95 @@
 #include <stddef.h>
 #include <dlfcn.h>
 #include "gsw_sys_interface.h"
+#include "gsw_log_interface.h"
 #define  LOG_LEVLE_CONFIG_FILE "/etc/telinit"
-#define  SSH_STATE_FILE "/tmp/ssh_mode"
-#define  FTP_STATE_FILE "/tmp/ftp_mode"
-#define  LIB_PATH		"/lib/libmbtk_lib.so"
-typedef void (*mbtk_log)(int level, const char *format,...);
-#ifndef LOG_ERR_LEVEL
-#define LOG_ERR_LEVEL  3      /* error conditions */
-#endif
-#define LOGE(fun_ptr_log, fmt, args...) \
-    do{ \
-        char *file_ptr_1001 = __FILE__; \
-        char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1;   \
-        char line_1001[10] = {0}; \
-        sprintf(line_1001, "%d", __LINE__); \
-        while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
-            if(*ptr_1001 == '/') \
-                 break; \
-            ptr_1001--; \
-        } \
-        fun_ptr_log(LOG_ERR_LEVEL,  "%s#%s: [gsw_sys]" fmt, ptr_1001 + 1, line_1001, ##args); \
-    } while(0)
-void write_mode_to_file(const char *file ,const char *mode)
-{
-	FILE *fp = fopen(file, "w");
-	if (!fp)
-	{
-		perror("Failed to open state file for writing");
-		return;
-	}
-	fprintf(fp, "%s\n", mode);
-	fclose(fp);
-}
-int read_mode_from_file(const char *file, char *mode, size_t size)
-{
-	FILE *fp = fopen(file, "r");
-	if (!fp)
-	{
-		return GSW_HAL_NORMAL_FAIL;  // No mode recorded
-	}
-	if (!fgets(mode, size, fp))
-	{
-		fclose(fp);		
-		return GSW_HAL_NORMAL_FAIL;
-	}
-	mode[strcspn(mode, "\n")] = '\0';
-	fclose(fp);
-	return GSW_HAL_SUCCESS;
-}
+
+#define GSW_SYS "[HAL][GSW_SYS]"
 int gsw_sys_svr_ftp_start(const char *cfg)
 {
 	int ret = GSW_HAL_SUCCESS;
 	char command[128];
-	mbtk_log fun_ptr_log;
-	void *handle = dlopen(LIB_PATH, RTLD_NOW);
-	if(NULL == handle)
-		return GSW_HAL_NORMAL_FAIL;
-	
-	fun_ptr_log = (mbtk_log)dlsym(handle, "mbtk_log");
-	if(fun_ptr_log ==  NULL)
-	{
-		ret = GSW_HAL_NORMAL_FAIL;
-		goto exit;
-	}
-	
+
 	if(NULL == cfg)
 	{
-		write_mode_to_file(FTP_STATE_FILE, "init.d");
 		strcpy(command, "/etc/init.d/vsftpd start");
 	}
 	else
 	{
-		write_mode_to_file(FTP_STATE_FILE, "vsftpd");
 		snprintf(command, sizeof(command), "vsftpd %s &", cfg);
 	}
 	ret = system(command);
 	if(ret != 0) {
-		LOGE(fun_ptr_log, "command execution failed command:%s.\n", command);
+		LOGE(GSW_SYS, "command execution failed command:%s.\n", command);
 		goto exit;
 	}
 exit:
-	dlclose(handle);
-	handle = NULL;
 	return ret;
 }
 int gsw_sys_svr_ftp_stop()
 {
 	int ret = GSW_HAL_SUCCESS;
-	char command[64];
-	char mode[64];
-	mbtk_log fun_ptr_log;
-	void *handle = dlopen(LIB_PATH, RTLD_NOW);
-	if(NULL == handle)
-		return GSW_HAL_NORMAL_FAIL;
 	
-	fun_ptr_log = (mbtk_log)dlsym(handle, "mbtk_log");
-	if(fun_ptr_log ==  NULL)
-	{
-		ret = GSW_HAL_NORMAL_FAIL;
-		goto exit;
-	}
-	
-	ret = read_mode_from_file(FTP_STATE_FILE, mode, sizeof(mode));
-	if(0 != ret)
-	{
-		LOGE(fun_ptr_log, "read file:%s error\n", FTP_STATE_FILE);
-		goto exit;
-	}
-	if(strlen(mode) == 0 || strcmp("init.d", mode) == 0)    //strlen(mode)==0为第一次执行
-		strcpy(command, "/etc/init.d/vsftpd stop");
-	else
-		strcpy(command, "killall -TERM vsftpd");
-	
-	ret = system(command);
+	ret = system("/etc/init.d/vsftpd stop");
 	if(ret != 0) 
 	{
-		LOGE(fun_ptr_log, "command execution failed command:%s.\n", command);
-		goto exit;
+		LOGE(GSW_SYS, "command /etc/init.d/vsftpd stop execution failed\n");
+		printf("FUNC:[%s] %d ret:%d\n", __FUNCTION__, __LINE__, ret);
+		ret = system("killall -TERM vsftpd");
+		if(ret != 0)
+		{
+			printf("FUNC:[%s] %d ret:%d\n", __FUNCTION__, __LINE__, ret);
+			LOGE(GSW_SYS, "command killall -TERM vsftpd execution failed\n");
+			goto exit;
+		}
 	}
 	
 exit:
-	dlclose(handle);
-	handle = NULL;
 	return ret;
 }
 int gsw_sys_svr_ssh_start(const char *cfg)
 {
 	int ret= GSW_HAL_SUCCESS;
 	char command[128];
-	mbtk_log fun_ptr_log;
-	void *handle = dlopen(LIB_PATH, RTLD_NOW);
-	if(NULL == handle)
-		return GSW_HAL_NORMAL_FAIL;
-	
-	fun_ptr_log = (mbtk_log)dlsym(handle, "mbtk_log");
-	if(fun_ptr_log ==  NULL)
-	{
-		ret = GSW_HAL_NORMAL_FAIL;
-		goto exit;
-	}
 		
 	if(NULL == cfg)
 	{			
-		write_mode_to_file(SSH_STATE_FILE, "init.d");
 		strcpy(command, "/etc/init.d/sshd start");
 	}
 	else
 	{
-		write_mode_to_file(SSH_STATE_FILE, "sshd");
 		snprintf(command, sizeof(command), "/usr/sbin/sshd -f %s &", cfg);
 	}
 	
 	ret = system(command);
 	if(ret != 0)
 	{
-		LOGE(fun_ptr_log, "command execution failed command:%s.\n", command);
+		LOGE(GSW_SYS, "command execution failed command:%s.\n", command);
 		goto exit;
 	}
 	
-exit:	
-	dlclose(handle);
-	handle = NULL;
+exit:
 	return ret;
 }
 int gsw_sys_svr_ssh_stop()
 {
 	int ret = GSW_HAL_SUCCESS;
-	char command[64];
-	char mode[64];
-	mbtk_log fun_ptr_log;
-	void *handle = dlopen(LIB_PATH, RTLD_NOW);
-	if(NULL == handle)
-		return GSW_HAL_NORMAL_FAIL;
 	
-	fun_ptr_log = (mbtk_log)dlsym(handle, "mbtk_log");
-	if(fun_ptr_log ==  NULL)
-	{
-		ret = GSW_HAL_NORMAL_FAIL;
-		goto exit;
-	}
-	
-	ret = read_mode_from_file(SSH_STATE_FILE, mode, sizeof(mode));
-	if(0 != ret)
-	{
-		LOGE(fun_ptr_log, "read file:%s error\n", SSH_STATE_FILE);
-		goto exit;
-	}
-	if(strlen(mode) == 0 || strcmp("init.d", mode) == 0)    //strlen(mode)==0为第一次执行
-		strcpy(command, "/etc/init.d/sshd stop");
-	else
-		strcpy(command, "killall sshd");
-	ret = system(command);
+	ret = system("/etc/init.d/sshd stop");
 	if(ret != 0) 
 	{
-		LOGE(fun_ptr_log, "command execution failed command:%s.\n", command);
-		goto exit;
+		printf("FUNC:[%s] %d ret:%d\n", __FUNCTION__, __LINE__, ret);
+		LOGE(GSW_SYS, "command /etc/init.d/sshd stop sshd execution failed\n");
+		ret = system("killall sshd");
+		if(ret != 0)
+		{
+			printf("FUNC:[%s] %d ret:%d\n", __FUNCTION__, __LINE__, ret);
+			LOGE(GSW_SYS, "command killall sshd execution failed\n");
+			goto exit;
+		}
 	}
 	
-exit:	
-	dlclose(handle);
-	handle = NULL;
+exit:
 	return ret;
 }
 int gsw_sys_svr_syslog_restart(const char *log_lvl)
@@ -216,17 +105,6 @@
 	int level = 0;
 	char *log_level_params[8] = {"emerg", "alert", "crit", "err", "warning", "notice", "info", "debug"};
 	char *log_level_values[8] = {"1", "2", "3", "4", "5", "6", "7", "8"};
-	mbtk_log fun_ptr_log;
-	void *handle = dlopen(LIB_PATH, RTLD_NOW);
-	if(NULL == handle)
-		return GSW_HAL_NORMAL_FAIL;
-	
-	fun_ptr_log = (mbtk_log)dlsym(handle, "mbtk_log");
-	if(fun_ptr_log ==  NULL)
-	{
-		ret = GSW_HAL_NORMAL_FAIL;
-		goto exit;
-	}
 	snprintf(command, sizeof(command), 
 			 "grep -q 'setprop sys.default.loglevel' %s", LOG_LEVLE_CONFIG_FILE);
 	for(level = 0; level < 8; level++)
@@ -236,7 +114,7 @@
 	}
 	if(8 == level)
 	{
-		LOGE(fun_ptr_log, "Parameter error\n");
+		LOGE(GSW_SYS, "Parameter error\n");
 		ret = GSW_HAL_NORMAL_FAIL;
 	    goto exit;
 	}
@@ -244,7 +122,7 @@
 	ret = system(command);
 	if (ret != 0)
 	{
-		LOGE(fun_ptr_log, "config option not exist.\n");
+		LOGE(GSW_SYS, "config option not exist.\n");
 	    goto exit;
 	}
 	snprintf(command, sizeof(command), 
@@ -254,12 +132,10 @@
 	ret = system(command);
 	if (ret != 0)
 	{
-	    LOGE(fun_ptr_log, "command execution failed.\n");
+	    LOGE(GSW_SYS, "command execution failed.\n");
 	    goto exit;
 	}
-exit:	
-	dlclose(handle);
-	handle = NULL;
+exit:
 	return ret;
 }
 
