hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
#
#
check_died() {
   while true;do
       pid=`pidof duer_linux alsa_audio_main_service`
       if [ "$pid" = "" ];then
           echo "dueros all died."
           break
       fi
       sleep 1
   done
}
 
enable_coredump() {
   if [ $dueros_debug -eq 1 ]; then
       #echo "/userdata/core-%s-%p-%e-%t" > /proc/sys/kernel/core_pattern
       echo "|/oem/core_helper %s %p %e %t" > /proc/sys/kernel/core_pattern
       ulimit -c unlimited
   fi
}
 
disable_coredump() {
   if [ $dueros_debug -eq 1 ]; then
       ulimit -S -c 0 > /dev/null 2>&1
   fi
}
 
case "$1" in
  start)
   echo "Starting $0..."
 
   # start audio preProcess
   ln -s /oem/baidu_spil_rk3308/* /data/ -f
   cd /data
   mkdir -p local/ipc
 
   enable_coredump
 
   ./setup.sh
   ./alsa_audio_main_service 6mic_loopback &
 
   # start dueros
   mkdir -p /data/duer/test && cd /data/duer
   ln -snf /oem/duer/* ./
   ./duer_linux &
   ;;
  stop)
   echo "Stop $0..."
   killall alsa_audio_main_service
   killall duer_linux
   ;;
  restart|reload)
   killall alsa_audio_main_service
   killall duer_linux
   check_died
   cd /data && ./alsa_audio_main_service 6mic_loopback &
   cd /data/duer && ./duer_linux &
   ;;
  *)
   echo "Usage: $0 {start|stop|restart}"
   exit 1
esac
 
exit $?