-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup.sh
104 lines (89 loc) · 2.28 KB
/
startup.sh
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/sh
#/bin/hostname arm201
# Set can
ifconfig can0 down
ifconfig can1 down
ifconfig can2 down
ifconfig can3 down
ip2 link set can0 type can bitrate 250000 restart-ms 20
ip2 link set can1 type can bitrate 250000 restart-ms 20
ip2 link set can2 type can bitrate 125000 restart-ms 20
ip2 link set can3 type can bitrate 250000 restart-ms 20
ifconfig can0 up
ifconfig can1 up
ifconfig can2 up
ifconfig can3 up
PRO_PATH="/program/pile/"
#check cron dir
myPath="/mnt/mmcblk0p1/"
if [ ! -d "$myPath" ];then
echo "no file"
return 0
else
if [ ! -h "/mnt/mmc" ];then
ln -s /mnt/mmcblk0p1/ /mnt/mmc
fi
fi
myPath="/etc/cron/crontabs/"
if [ ! -d "$myPath" ]; then
mkdir -p "$myPath"
fi
if [ ! -x "/program/pile/targz.sh" ]; then
chmod 777 /program/pile/targz.sh
fi
if [ ! -x "/program/pile/deleteFileOld.sh" ]; then
chmod 777 /program/pile/deleteFileOld.sh
fi
if [ -e "$PRO_PATH"root ]; then
cp "$PRO_PATH"root "$myPath"
myPath=`ps -ef|grep '\bcrond\b'|grep -v grep`
if [ "$myPath" = "" ]; then
crond
fi
myPath="/mnt/mmc/"
if [ -d "$myPath" ]; then
#check bms dir
myPath1="/mnt/mmc/bmsA/"
if [ ! -d "$myPath1" ]; then
mkdir -p "$myPath1"
fi
myPath1B="/mnt/mmc/bmsB/"
if [ ! -d "$myPath1B" ]; then
mkdir -p "$myPath1B"
fi
#check tcu dir
myPath2="/mnt/mmc/tcuA/"
if [ ! -d "$myPath2" ]; then
mkdir -p "$myPath2"
fi
myPath2B="/mnt/mmc/tcuB/"
if [ ! -d "$myPath2B" ]; then
mkdir -p "$myPath2B"
fi
#check ini dir
myPath3="/mnt/mmc/ini/"
if [ -d "$myPath3" ]; then
cp /mnt/mmc/ini/* /program/pile/
fi
#check ftpsend dir
myPath4="/mnt/mmc/ftpsendA/"
if [ ! -d "$myPath4" ]; then
mkdir -p "$myPath4"
fi
myPath5="/mnt/mmc/ftpsendB/"
if [ ! -d "$myPath5" ]; then
mkdir -p "$myPath5"
fi
hwclock -s --localtime
# Set search library path
export LD_LIBRARY_PATH=/lib:/usr/lib:/lib/qt485/lib:.
nohup "$PRO_PATH"run_pile.sh >> /program/pile/my.log 2>&1 &
if [ ! -x "/program/pile/guardPile.sh" ]; then
chmod 777 "$PRO_PATH"guardPile.sh
fi
nohup "$PRO_PATH"guardPile.sh > /dev/null 2>&1 &
fi
exit 0
echo "error start, do not found mmc/log file!"
fi
echo "error start, do not found root file"