[Feature][T106][task-view-307][SDK-READY]add protection process of services
Only Configure: NO
Affected branch: master
Affected module: sdk-ready
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update:Noy
Change-Id: I72f63237f0dffacd4013f87a0c960fc5b1b9e59f
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/rcS b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/rcS
index e7959fe..0cb2386 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/rcS
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/rcS
@@ -35,5 +35,6 @@
. /etc/rc.local
+sh /etc/lynq_monitor.sh &
exit 0
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/lynq_monitor.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/lynq_monitor.sh
new file mode 100644
index 0000000..72e61c7
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/lynq_monitor.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+while true
+do
+ sleep 30
+ ps -ef|grep lynq-sdk-ready |grep -v "grep" > /dev/null
+ if [ $? -ne 0 ]; then
+ echo "lynq-sdk-ready no exist" > /dev/kmsg
+ sh /etc/init.d/lynq-sdk-ready.sh start
+ else
+ ps -A -ostat,pid,comm |grep lynq-sdk-ready| grep Z > /dev/null
+ if [ $? -eq 0 ]; then
+ echo "lynq-sdk-ready state is Z" > /dev/kmsg
+ pid=$(ps -A -ostat,pid,comm |grep lynq-sdk-ready|grep Z|awk '{print $2}')
+ kill -9 $pid
+ sh /etc/init.d/lynq-sdk-ready.sh start
+ fi
+ fi
+
+ ps -ef|grep lynq-atcid |grep -v "grep" > /dev/null
+ if [ $? -ne 0 ]; then
+ echo "lynq-atcid no exist" > /dev/kmsg
+ sh /etc/init.d/lynq-atcid.sh start
+ else
+ ps -A -ostat,pid,comm |grep lynq-atcid| grep Z > /dev/null
+ if [ $? -eq 0 ]; then
+ echo "lynq-atcid state is Z" > /dev/kmsg
+ pid=$(ps -A -ostat,pid,comm |grep lynq-atcid|grep Z|awk '{print $2}')
+ kill -9 $pid
+ sh /etc/init.d/lynq-atcid.sh start
+ fi
+ fi
+
+ ps -ef|grep lynq-ril-service |grep -v "grep" > /dev/null
+ if [ $? -ne 0 ]; then
+ echo "lynq-ril-service no exist" > /dev/kmsg
+ sh /etc/init.d/lynq-ril-service.sh start
+ else
+ ps -A -ostat,pid,comm |grep lynq-ril-service| grep Z > /dev/null
+ if [ $? -eq 0 ]; then
+ echo "lynq-ril-service state is Z" > /dev/kmsg
+ pid=$(ps -A -ostat,pid,comm |grep lynq-ril-service|grep Z|awk '{print $2}')
+ kill -9 $pid
+ sh /etc/init.d/lynq-ril-service.sh start
+ fi
+ fi
+
+ ps -ef|grep autosuspend |grep -v "grep" > /dev/null
+ if [ $? -ne 0 ]; then
+ echo "lynq-autosuspend no exist" > /dev/kmsg
+ sh /etc/init.d/lynq-autosuspend.sh start
+ else
+ ps -A -ostat,pid,comm |grep autosuspend| grep Z > /dev/null
+ if [ $? -eq 0 ]; then
+ echo "lynq-autosuspend state is Z" > /dev/kmsg
+ pid=$(ps -A -ostat,pid,comm |grep autosuspend|grep Z|awk '{print $2}')
+ kill -9 $pid
+ sh /etc/init.d/lynq-autosuspend.sh start
+ fi
+ fi
+done