|
|
@@ -524,15 +524,43 @@ static int file_clear(void)
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
//////////////////////////////////////////////////
|
|
|
+static int is_running(char *prog)
|
|
|
+{
|
|
|
+ FILE *fp;
|
|
|
+ int pid=0;
|
|
|
+ char buf[20]={0};
|
|
|
+ char command[200];
|
|
|
+
|
|
|
+ snprintf(command, sizeof(command), "ps -ef | grep -v grep | grep -w -c %s", prog);
|
|
|
+
|
|
|
+ fp = popen(command, "r");
|
|
|
+ if (fp == NULL) {
|
|
|
+ LOGE("execute %s failed: %s", command, strerror(errno));
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fgets(buf, sizeof(buf), fp)) {
|
|
|
+ pid = atoi(buf);
|
|
|
+ }
|
|
|
+ pclose(fp);
|
|
|
+
|
|
|
+ return (pid)?1:0;
|
|
|
+}
|
|
|
+
|
|
|
static int app_start(void)
|
|
|
{
|
|
|
- return 0;//system("smartMonitor.sh &");
|
|
|
+ LOGD("____ app_start\n");
|
|
|
+
|
|
|
+ if(is_running("smartMonitor.sh")) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ return system("/usr/sbin/smartMonitor.sh &");
|
|
|
}
|
|
|
static int app_stop(void)
|
|
|
{
|
|
|
- return 0;//system("killall smartMonitor.sh && /etc/init.d/S90PDUApp stop");
|
|
|
+ LOGD("____ app_stop\n");
|
|
|
+ return system("killall smartMonitor.sh; /etc/init.d/S90PDUApp stop");
|
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////
|
|
|
@@ -686,7 +714,6 @@ static int upg_handle(upg_handle_t *h)
|
|
|
if(r==0) {
|
|
|
file_touch(UPGRADE_STEP_COVER);
|
|
|
h->step = UPGRADE_STEP_FINISH;
|
|
|
- app_start();
|
|
|
}
|
|
|
else {
|
|
|
LOGD("file_cover, delete %s!\n", tmp);
|
|
|
@@ -698,10 +725,11 @@ static int upg_handle(upg_handle_t *h)
|
|
|
file_untouch(UPGRADE_STEP_COVER);
|
|
|
|
|
|
file_restore();
|
|
|
- app_start();
|
|
|
+
|
|
|
}
|
|
|
file_untouch(UPGRADE_STEP_DOWN);
|
|
|
file_untouch(UPGRADE_STEP_SPLIT);
|
|
|
+ app_start();
|
|
|
}
|
|
|
break;
|
|
|
|