-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_alias_train.sh
More file actions
90 lines (76 loc) · 4.57 KB
/
Copy pathrun_alias_train.sh
File metadata and controls
90 lines (76 loc) · 4.57 KB
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
#!/bin/bash
# 开始行标志
start_string="###beginofchenzhen'salias_train###"
# 结束行标志
end_string="###endofchenzhen'salias_train###"
# 查找包含起始内容和结束内容的行,并删除这之间的行
start_line=$(grep -n "$start_string" /etc/bashrc | cut -d ':' -f1)
end_line=$(grep -n "$end_string" /etc/bashrc | cut -d ':' -f1)
if grep -q "$start_string" /etc/bashrc && grep -q "$end_string" /etc/bashrc ; then
echo ".bashrc被alias_car修改过"
sed -i "/$start_string/,/$end_string/d" /etc/bashrc && echo 清理.bashrc成功
else
echo ".bashrc未alias_car被修改过"
fi
# 打印开始行标志
cat << EOF >> /etc/bashrc
$start_string
EOF
cat << EOF >> /etc/bashrc
#火车组快捷路径
alias pcd='cd /home/storage/load/train/data/lidar/pcd'
alias csv='cd /home/storage/load/train/data/lidar/csv'
alias yaml='cd /home/storage/load/config'
alias om='cd /home/storage/load/models'
alias zc='cd /home/storage/load/client'
alias cz='cd /home/storage/matrixai/cz/project'
alias dlc='cd /home/storage/load/dlc/'
alias cap='cd /home/storage/capture'
#快捷点位
alias 0209='echo -n "8D08200209000000" | xxd -r -p | nc localhost 6669 && echo 加载通用参数完成'
alias 0401='echo -n "8D08200401000000" | xxd -r -p | nc localhost 6669 && echo 测试读PLC配煤量,掐煤量,车节号完成'
alias 1402='echo -n "8D08201402000000" | xxd -r -p | nc localhost 6669 && echo 读车号 完成'
alias 1404='echo -n "8D08201404000000" | xxd -r -p | nc localhost 6669 && echo 读车号 写plc 完成'
alias 302='echo -n "8D08200403020000" | xxd -r -p | nc localhost 6669 && echo 装车完成之后 重新读plc装车数据 发送给web完成'
alias 0001='docker exec -it capture sh -c "echo '0001' > /dev/stdin" && sleep 2 && echo "输入如下命令进入日志保存文件夹获取日志" && echo "cd /home/storage/capture"'
alias cap1='echo "start" > /home/storage/capture/start.txt && echo "输入如下命令进入日志保存文件夹获取日志" && echo "cd /home/storage/capture" && echo "等待十秒左右即可缓存完视频 即可下载"'
#火车组定制化功能
alias logc="docker logs -f --tail 1000 cli | grep -E '车坑|归零|溜槽|配煤|从关到位变成开|流速|检测到|发送定量仓闸板开指令|检测到两个闸板同时开|车头装车,溜槽下压; 当前位置|9181\] 车节号:|溜槽提升至安全高度|当前装车高度:|上一节高度|匹配到均值:|溜槽提升|probability'"
alias logm="docker logs -f --tail 800 ser"
alias rs-c="docker restart cli"
alias rs-m="docker restart ser"
alias rs-cm="docker restart ser && docker restart cli"
alias g0='clear && docker logs --tail=2000 cli > /home/zeroPoint.log && docker exec -it tools python zeroPoint.py'
alias 1p='clear && docker logs --tail=2000 cli > /home/onePoint-V21.log && docker exec -it tools python onePoint-V21-5.py'
alias 2p='clear && docker logs --tail=2000 cli > /home/onePoint-V22.log && docker exec -it tools python onePoint-V22-6.5.py'
alias up-c='mv client /home/storage/load/client/client && chmod 777 /home/storage/load/client/client && docker cp cli:/app/client /home/storage/load/client/client_last && docker cp /home/storage/load/client/client cli:/app/client && docker restart cli'
alias up-m='mv main /home/storage/load/server/main && chmod 777 /home/storage/load/server/main && docker cp ser:/app/main /home/storage/load/server/main_last && docker cp /home/storage/load/server/main ser:/app/main && docker restart ser'
zc
EOF
#检查系统是否为arm架构
if [[ $(uname -m) == 'aarch64' ]]; then
echo "CPU为arm64架构 添加nx环境变量"
cat << EOF >> /etc/bashrc
#nx小站转换识别模型的环境变量
export PATH=/usr/local/cuda-10.2/bin:$PATH
export PATH=$PATH:/opt/cmake-3.24.1/bin
export PATH=/usr/src/tensorrt/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
EOF
fi
#打印结束行标志
cat << EOF >> /etc/bashrc
$end_string
EOF
# chmod 777 docker-logs-localtime
# mv docker-logs-localtime /usr/local/bin
source /etc/bashrc && echo ".bashrc修改完成"
#如果没有/home/storage/matrixai/cz/project文件路径则创建
if [ ! -d "/home/storage/matrixai/cz/project" ]; then
echo "创建/home/storage/matrixai/cz/project文件夹"
mkdir -p /home/storage/matrixai/cz/project
fi
echo 请手动执行如下命令
echo "source /etc/bashrc"
#alias czlog='docker logs --since=$(date -d "2 hours ago" "+%Y-%m-%dT%H:%M:%S") --until=$(date "+%Y-%m-%dT%H:%M:%S") cli > $(date -d "2 hours ago" "+%Y-%m-%dT%H:%M:%S")_cli.log'
#无用 alias czlog='docker logs --since=2024-08-21T14:59:53 --until=2024-08-21T16:59:53 cli > 2024-08-21T14:59:53_cli.log'