-
scintist 说:
@ChatGPT 如何理解“要完整、准确、全面贯彻新发展理念,加快构建新发展格局,着力推动高质量发展”
“要完整、准确、全面贯彻新发展理念,加快构建新发展格局,着力推动高质量发展”,是指在当前中国社会经济发展的背景下,需要坚持新发展理念,以加快构建新的发展格局,着力推动高质量的经济发展。
其中,“完整、准确、全面贯彻新发展理念”意味着在各个方面和各个阶段都要贯彻新发展理念,这可以使经济和社会发展更加科学和可持续。
“加快构建新发展格局”则是指在众多的制度和政策保障的基础上,深化各种改革,努力推动经济的新发展形态和新产业的发展,为全国经济持续快速发展提供保障。
最后,“着力推动高质量发展”是指通过有效的科学系统和可行的手段,在不断提升经济发展效益和质量的同时,还必须加快创新,提高科技水平和创新能力,增强核心竞争力,使中国的经济发展能够更快更好地增长,更加优势地面向未来,更加符合人民群众的根本利益和期待。
-
@ChatGPT #!/bin/bash
argv=$1
#deploy=$1
count=0
filename=()
isTar=1
if [ $isTar == "1" ]
thenpath=
cd $(dirname $0);pwd -P
#echo the current path is:$path
for i inls
do
filegz="tar.gz"
if [[ $i == $filegz ]]
then
#echo $i
filename[count]=$i
count=expr $count + 1
fi
done#echo $count
#echo ${filename[@]}
for((n=0;n<${#filename[@]};n++)){
echo -e "\033[40;35m"$n"\033[0m \033[40;32m"${filename[n]}"\033[0m"
}if (("$count" <= "0"));
then
echo "请下载部署包"
exit
elif (("$count" == "1"));
then
if [ $argv == "PBox" ];
then
tar zxvf ${filename[0]} -C /pbox
else
tar zxvf ${filename[0]} -C /mnt
fi
else
echo -e "\033[40;36m 请选择部署包:\033[0m"
read inNum
if (("$inNum" < "0")) || (("$inNum" >= "$count"))
then
echo "索引错误"
exit
else
if [ $argv == "PBox" ];
then
tar zxvf ${filename[0]} -C /pbox
else
tar zxvf ${filename[0]} -C /mnt
fi
fi
fi
fi#echo "解压部署包"
#echo $deploy
#tar -zxvf $deploy
#echo "解压部署包完成"inspect(){
if [ $argv != "PBox16.04" ];
then
cp -rf /mnt/profile /etc/
fi
if [ ! -d "/mnt/FCloudComm" ]
then
echo "1"
exit
fi
if [ ! -f "/mnt/run.sh" ]
then
echo "2"
exit
fiif [ ! -f "/usr/lib/libiconv.so.2.6.1" ]; then cp -rf /mnt/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/ ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2 fi sed -i '/source/d' /etc/init.d/rc.local sed -i '$a source /mnt/run.sh' /etc/init.d/rc.local #taosd &>/dev/null echo "历史数据库安装完成"
}
inspectPBox(){
if [ ! -d "/pbox/FCloudComm" ]
then
echo "1"
exit
fi
if [ ! -f "/pbox/run.sh" ]
then
echo "2"
exit
fiif [ ! -f "/usr/lib/libiconv.so.2.6.1" ]; then cp -rf /pbox/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/ ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2 fi #taosd &>/dev/null echo "历史数据库安装完成"
}
echo "拷贝系统文件"
if [ $argv == "8401d" ];
then
cp -rf ./libstdc++.so.6 /usr/lib/arm-linux-gnueabihf/
cp -rf ./libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/
fiif [ $argv == "ISG" ];
then
cp -rf ./libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/
ln -sf /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6if [ ! -f "/usr/lib/libatomic.so.1.0.0" ];
then
cp -rf /mnt/FCloudComm/bin/libatomic.so.1.0.0 /usr/lib/
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so.1
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so
fi
fiecho "拷贝系统文件完成"
echo -e "\033[40;36m 网口选择 单网(1)双网(2) \033[0m"
read input
#echo $input
if [ $input == "1" ];
then
sed -i 's/NetCardCount = "2"/NetCardCount = "1"/g' /mnt/FCloudComm/bin/pSL_Setting.xml
sed -i '/sleep 1/d' /mnt/FCloudComm/tools/IPCfg
sed -i '/ifconfig eth1 192.168.20.101 netmask 255.255.255.0 up/d' /mnt/FCloudComm/tools/IPCfg
sed -i '/route add default gw 192.168.20.1 dev eth1/d' /mnt/FCloudComm/tools/IPCfg
fi
echo "网口配置完成"#4G函数
echo -e "\033[40;36m 是否支持4G? 否(0)是(1) \033[0m"read -p "" number
if [ $number -eq 0 ];
then
if [ $argv == "8401d" ];
then
sed -i '/active4g.sh/d' /mnt/run.sh
fiif [ $argv == "PBox" ]; then sed -i '/quectel-pppd.sh/d' /pbox/run.sh fi if [ $argv == "PBox16.04" ]; then sed -i '/quectel-pppd.sh/d' /mnt/run.sh fi
fi
if [ $number -eq 1 ];
then
if [ $argv == "8401d" ];
then
sed -i '/active4g.sh/d' /mnt/run.sh
sed -i '/sleep 10/i\sh ./active4g.sh &' /mnt/run.sh
fiif [ $argv == "PBox" ]; then sed -i '/quectel-pppd.sh/d' /pbox/run.sh sed -i '/sleep 10/i\sh ./quectel-pppd.sh &' /pbox/run.sh fi if [ $argv == "PBox16.04" ]; then sed -i '/quectel-pppd.sh/d' /mnt/run.sh sed -i '/sleep 10/i\sh ./quectel-pppd.sh &' /mnt/run.sh fi
fi
if [ $number -ne 1 ] && [ $number -ne 0 ];
then
echo "输入错误"
fiecho "配置开机启动"
if [ $argv == "8401d" ];
then
sed -i '1c #! /bin/bash' /etc/init.d/rc.local
fiif [ $argv == "PBox16.04" ];
then
sed -i '1c #! /bin/bash' /etc/rc.local
fiif [ $argv == "ISG" ];
then
sed -i '1c #! /bin/bash' /etc/init.d/rocktech.sh
sed -i '/source/d' /etc/init.d/rocktech.sh
sed -i '$a source /mnt/run.sh' /etc/init.d/rocktech.sh
sed -i '/source/d' /etc/init.d/rc.local
sed -i "114s:#::g" /etc/init.d/rocktech.sh
fiecho "配置开机启动完成"
echo "初始化本地ip地址"
sed -i 's/address 190.5.20.171/address 192.168.10.101/g' /etc/network/interfaces
sed -i 's/gateway 190.5.200.11/gateway 192.168.10.1/g' /etc/network/interfaces
sed -i 's/address 192.168.1.100/address 192.168.20.101/g' /etc/network/interfaces
sed -i 's/gateway 192.168.1.1/gateway 192.168.20.1/g' /etc/network/interfaces
echo "初始化本地ip地址结束"echo "配置历史数据库"
#td库ISG网关配置
td(){
cd /mnt/TDengine-server-2.0.10.0/
./install.sh &>/dev/null
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
sed -i 's/# fqdn/fqdn/g' /etc/taos/taos.cfg
sed -i 's/hostname/localhost/g' /etc/taos/taos.cfg
}#PBox网关配置
PB(){
if [ ! -f "/usr/lib/libatomic.so.1.0.0" ];
then
cp -rf /pbox/FCloudComm/bin/libatomic.so.1.0.0 /usr/lib/
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so.1
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so
fised -i '1c #! /bin/bash' /etc/init.d/rc.local cd /pbox/TDengine-server-2.0.10.0 ./install.sh &>/dev/null sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg sed -i 's/# logDir/ logDir/g' /etc/taos/taos.cfg sed -i 's/# dataDir/ dataDir/g' /etc/taos/taos.cfg sed -i 's#/var/log/taos#/pbox/log#g' /etc/taos/taos.cfg sed -i 's#/var/lib/taos#/pbox/lib#g' /etc/taos/taos.cfg sed -i '/run.sh/d' /etc/rc5.d/S99rmnologin.sh sed -i '$a source /pbox/run.sh' /etc/rc5.d/S99rmnologin.sh
}
power(){
source /mnt/FCloudComm/tools/setEnv.sh
if [ -d "/mnt/config" ];then
#echo "文件夹存在"if [ -f "/mnt/config/hardwareinfo.HID" ];then #echo "文件存在" cp -rf /mnt/config/hardwareinfo.HID /mnt/FCloudComm else #echo "文件不存在" echo "配置完成 请放入HID 和 授权文件" /mnt/FCloudComm/bin/getID fi if [ -f "/mnt/config/"*".lic" ];then #echo "文件存在" cp -rf /mnt/config/*.lic /mnt/FCloudComm/bin else #echo "文件不存在" echo "配置完成 请放入HID 和 授权文件" /mnt/FCloudComm/bin/getID fi else #echo "文件夹不存在" echo "配置完成 请放入HID 和 授权文件" /mnt/FCloudComm/bin/getID fi #echo "配置完成 请放入HID 和 授权文件" #/mnt/FCloudComm/bin/getID
}
powerPBox(){
source /pbox/FCloudComm/tools/setEnv.sh
if [ -d "/pbox/config" ];then
#echo "文件夹存在"if [ -f "/pbox/config/hardwareinfo.HID" ];then #echo "文件存在" cp -rf /pbox/config/hardwareinfo.HID /pbox/FCloudComm else #echo "文件不存在" echo "配置完成 请放入HID 和 授权文件" /pbox/FCloudComm/bin/getID fi if [ -f "/pbox/config/"*".lic" ];then #echo "文件存在" cp -rf /pbox/config/*.lic /pbox/FCloudComm/bin else #echo "文件不存在" echo "配置完成 请放入HID 和 授权文件" /pbox/FCloudComm/bin/getID fi else #echo "文件夹不存在" echo "配置完成 请放入HID 和 授权文件" /pbox/FCloudComm/bin/getID fi #echo "配置完成 请放入HID 和 授权文件" #/pbox/FCloudComm/bin/getID
}
case "$1" in
8401d)
cd /mnt/TDengine-server-2.0.10.0
./install.sh &>/dev/null
sed -i 's#/third/log#log#g' /etc/taos/taos.cfg
sed -i 's#/third/data#data#g' /etc/taos/taos.cfg
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
inspect
power
;;
8316)
i="0"
while read path
do
if [ "$path" == "127.0.0.1 GEA-8316-DLK" ];
then
i="1"
fi
done < /etc/hostsif [ "$i" != "1" ]; then sed -i '$a\127.0.0.1 GEA-8316-DLK' /etc/hosts fi cd /mnt/TDengine-server-2.0.10.0 ./install.sh &>/dev/null sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg inspect power ;; ISG) i="0" while read path do if [ "$path" == "127.0.0.1 localhost" ]; then i="1" fi done < /etc/hosts if [ "$i" != "1" ]; then echo "127.0.0.1 localhost"> /etc/hosts fi td inspect power ;; PBox) i="0" while read path do if [ "$path" == "127.0.0.1 imx6ull14x14evk" ]; then i="1" fi done < /etc/hosts if [ "$i" != "1" ]; then echo "127.0.0.1 imx6ull14x14evk"> /etc/hosts fi PB inspectPBox powerPBox ;; PBox16.04) pkexec chown root:root /etc/sudoers /etc/sudoers.d -R td inspect power sed -i '/source/d' /etc/init.d/rc.local sed -i '/source/d' /etc/rc.local sed -i '/sleep 1/isource /mnt/run.sh' /etc/rc.local ;;
esac
用python重写
-
for culture 说:
@ChatGPT #!/bin/bash
argv=$1
#deploy=$1
count=0
filename=()
isTar=1
if [ $isTar == "1" ]
thenpath=
cd $(dirname $0);pwd -P
#echo the current path is:$path
for i inls
do
filegz="tar.gz"
if [[ $i == $filegz ]]
then
#echo $i
filename[count]=$i
count=expr $count + 1
fi
done#echo $count
#echo ${filename[@]}
for((n=0;n echo -e "\033[40;35m"$n"\033[0m \033[40;32m"${filename[n]}"\033[0m"
}if (("$count" then
echo "请下载部署包"
exit
elif (("$count" == "1"));
then
if [ $argv == "PBox" ];
then
tar zxvf ${filename[0]} -C /pbox
else
tar zxvf ${filename[0]} -C /mnt
fi
else
echo -e "\033[40;36m 请选择部署包:\033[0m"
read inNum
if (("$inNum" = "$count"))
then
echo "索引错误"
exit
else
if [ $argv == "PBox" ];
then
tar zxvf ${filename[0]} -C /pbox
else
tar zxvf ${filename[0]} -C /mnt
fi
fi
fi
fi#echo "解压部署包"
#echo $deploy
#tar -zxvf $deploy
#echo "解压部署包完成"inspect(){
if [ $argv != "PBox16.04" ];
then
cp -rf /mnt/profile /etc/
fi
if [ ! -d "/mnt/FCloudComm" ]
then
echo "1"
exit
fi
if [ ! -f "/mnt/run.sh" ]
then
echo "2"
exit
fiif [ ! -f "/usr/lib/libiconv.so.2.6.1" ];
then
cp -rf /mnt/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/
ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so
ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2
fised -i '/source/d' /etc/init.d/rc.local
sed -i '$a source /mnt/run.sh' /etc/init.d/rc.local#taosd &>/dev/null
echo "历史数据库安装完成"}
inspectPBox(){
if [ ! -d "/pbox/FCloudComm" ]
then
echo "1"
exit
fi
if [ ! -f "/pbox/run.sh" ]
then
echo "2"
exit
fiif [ ! -f "/usr/lib/libiconv.so.2.6.1" ];
then
cp -rf /pbox/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/
ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so
ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2
fi#taosd &>/dev/null
echo "历史数据库安装完成"}
echo "拷贝系统文件"
if [ $argv == "8401d" ];
then
cp -rf ./libstdc++.so.6 /usr/lib/arm-linux-gnueabihf/
cp -rf ./libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/
fiif [ $argv == "ISG" ];
then
cp -rf ./libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/
ln -sf /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6if [ ! -f "/usr/lib/libatomic.so.1.0.0" ];
then
cp -rf /mnt/FCloudComm/bin/libatomic.so.1.0.0 /usr/lib/
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so.1
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so
fi
fiecho "拷贝系统文件完成"
echo -e "\033[40;36m 网口选择 单网(1)双网(2) \033[0m"
read input
#echo $input
if [ $input == "1" ];
then
sed -i 's/NetCardCount = "2"/NetCardCount = "1"/g' /mnt/FCloudComm/bin/pSL_Setting.xml
sed -i '/sleep 1/d' /mnt/FCloudComm/tools/IPCfg
sed -i '/ifconfig eth1 192.168.20.101 netmask 255.255.255.0 up/d' /mnt/FCloudComm/tools/IPCfg
sed -i '/route add default gw 192.168.20.1 dev eth1/d' /mnt/FCloudComm/tools/IPCfg
fi
echo "网口配置完成"#4G函数
echo -e "\033[40;36m 是否支持4G? 否(0)是(1) \033[0m"read -p "" number
if [ $number -eq 0 ];
then
if [ $argv == "8401d" ];
then
sed -i '/active4g.sh/d' /mnt/run.sh
fiif [ $argv == "PBox" ];
then
sed -i '/quectel-pppd.sh/d' /pbox/run.sh
fiif [ $argv == "PBox16.04" ];
then
sed -i '/quectel-pppd.sh/d' /mnt/run.sh
fi
fiif [ $number -eq 1 ];
then
if [ $argv == "8401d" ];
then
sed -i '/active4g.sh/d' /mnt/run.sh
sed -i '/sleep 10/i\sh ./active4g.sh &' /mnt/run.sh
fiif [ $argv == "PBox" ];
then
sed -i '/quectel-pppd.sh/d' /pbox/run.sh
sed -i '/sleep 10/i\sh ./quectel-pppd.sh &' /pbox/run.sh
fiif [ $argv == "PBox16.04" ];
then
sed -i '/quectel-pppd.sh/d' /mnt/run.sh
sed -i '/sleep 10/i\sh ./quectel-pppd.sh &' /mnt/run.sh
fi
fiif [ $number -ne 1 ] && [ $number -ne 0 ];
then
echo "输入错误"
fiecho "配置开机启动"
if [ $argv == "8401d" ];
then
sed -i '1c #! /bin/bash' /etc/init.d/rc.local
fiif [ $argv == "PBox16.04" ];
then
sed -i '1c #! /bin/bash' /etc/rc.local
fiif [ $argv == "ISG" ];
then
sed -i '1c #! /bin/bash' /etc/init.d/rocktech.sh
sed -i '/source/d' /etc/init.d/rocktech.sh
sed -i '$a source /mnt/run.sh' /etc/init.d/rocktech.sh
sed -i '/source/d' /etc/init.d/rc.local
sed -i "114s:#::g" /etc/init.d/rocktech.sh
fiecho "配置开机启动完成"
echo "初始化本地ip地址"
sed -i 's/address 190.5.20.171/address 192.168.10.101/g' /etc/network/interfaces
sed -i 's/gateway 190.5.200.11/gateway 192.168.10.1/g' /etc/network/interfaces
sed -i 's/address 192.168.1.100/address 192.168.20.101/g' /etc/network/interfaces
sed -i 's/gateway 192.168.1.1/gateway 192.168.20.1/g' /etc/network/interfaces
echo "初始化本地ip地址结束"echo "配置历史数据库"
#td库ISG网关配置
td(){
cd /mnt/TDengine-server-2.0.10.0/
./install.sh &>/dev/null
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
sed -i 's/# fqdn/fqdn/g' /etc/taos/taos.cfg
sed -i 's/hostname/localhost/g' /etc/taos/taos.cfg
}#PBox网关配置
PB(){
if [ ! -f "/usr/lib/libatomic.so.1.0.0" ];
then
cp -rf /pbox/FCloudComm/bin/libatomic.so.1.0.0 /usr/lib/
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so.1
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so
fised -i '1c #! /bin/bash' /etc/init.d/rc.local
cd /pbox/TDengine-server-2.0.10.0
./install.sh &>/dev/null
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
sed -i 's/# logDir/ logDir/g' /etc/taos/taos.cfg
sed -i 's/# dataDir/ dataDir/g' /etc/taos/taos.cfg
sed -i 's#/var/log/taos#/pbox/log#g' /etc/taos/taos.cfg
sed -i 's#/var/lib/taos#/pbox/lib#g' /etc/taos/taos.cfgsed -i '/run.sh/d' /etc/rc5.d/S99rmnologin.sh
sed -i '$a source /pbox/run.sh' /etc/rc5.d/S99rmnologin.sh
}power(){
source /mnt/FCloudComm/tools/setEnv.sh
if [ -d "/mnt/config" ];then
#echo "文件夹存在"if [ -f "/mnt/config/hardwareinfo.HID" ];then
#echo "文件存在"
cp -rf /mnt/config/hardwareinfo.HID /mnt/FCloudComm
else
#echo "文件不存在"
echo "配置完成 请放入HID 和 授权文件"
/mnt/FCloudComm/bin/getID
fiif [ -f "/mnt/config/"".lic" ];then
#echo "文件存在"
cp -rf /mnt/config/.lic /mnt/FCloudComm/bin
else
#echo "文件不存在"
echo "配置完成 请放入HID 和 授权文件"
/mnt/FCloudComm/bin/getID
fielse
#echo "文件夹不存在"
echo "配置完成 请放入HID 和 授权文件"
/mnt/FCloudComm/bin/getID
fi
#echo "配置完成 请放入HID 和 授权文件"
#/mnt/FCloudComm/bin/getID
}powerPBox(){
source /pbox/FCloudComm/tools/setEnv.sh
if [ -d "/pbox/config" ];then
#echo "文件夹存在"if [ -f "/pbox/config/hardwareinfo.HID" ];then
#echo "文件存在"
cp -rf /pbox/config/hardwareinfo.HID /pbox/FCloudComm
else
#echo "文件不存在"
echo "配置完成 请放入HID 和 授权文件"
/pbox/FCloudComm/bin/getID
fiif [ -f "/pbox/config/"".lic" ];then
#echo "文件存在"
cp -rf /pbox/config/.lic /pbox/FCloudComm/bin
else
#echo "文件不存在"
echo "配置完成 请放入HID 和 授权文件"
/pbox/FCloudComm/bin/getID
fielse
#echo "文件夹不存在"
echo "配置完成 请放入HID 和 授权文件"
/pbox/FCloudComm/bin/getID
fi
#echo "配置完成 请放入HID 和 授权文件"
#/pbox/FCloudComm/bin/getID
}case "$1" in
8401d)
cd /mnt/TDengine-server-2.0.10.0
./install.sh &>/dev/null
sed -i 's#/third/log#log#g' /etc/taos/taos.cfg
sed -i 's#/third/data#data#g' /etc/taos/taos.cfg
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
inspect
power
;;
8316)
i="0"
while read path
do
if [ "$path" == "127.0.0.1 GEA-8316-DLK" ];
then
i="1"
fi
done
if [ "$i" != "1" ];
then
sed -i '$a\127.0.0.1 GEA-8316-DLK' /etc/hosts
ficd /mnt/TDengine-server-2.0.10.0 ./install.sh &>/dev/null sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg inspect power ;;
ISG)
i="0"
while read path
do
if [ "$path" == "127.0.0.1 localhost" ];
then
i="1"
fi
done
if [ "$i" != "1" ];
then
echo "127.0.0.1 localhost"> /etc/hosts
fitd inspect power ;;
PBox)
i="0"
while read path
do
if [ "$path" == "127.0.0.1 imx6ull14x14evk" ];
then
i="1"
fi
done
if [ "$i" != "1" ];
then
echo "127.0.0.1 imx6ull14x14evk"> /etc/hosts
fi
PB
inspectPBox
powerPBox
;;
PBox16.04)
pkexec chown root:root /etc/sudoers /etc/sudoers.d -R
td
inspect
power
sed -i '/source/d' /etc/init.d/rc.local
sed -i '/source/d' /etc/rc.local
sed -i '/sleep 1/isource /mnt/run.sh' /etc/rc.local
;;
esac用python重写
把原先的bash脚本用Python来实现,具体如下:
#!/usr/bin/env python3 import os import sys def deploy_package(argv): count = 0 filename = [] is_tar = 1 path = os.path.abspath(os.path.dirname(__file__)) for file in os.listdir(path): if is_tar and file.endswith(".tar.gz"): filename.append(file) count += 1 if count = count: print("索引错误") sys.exit() else: tar_path = "/pbox" if argv == "PBox" else "/mnt" os.system(f"tar zxvf {filename[inNum]} -C {tar_path}") def system_init(argv): if argv != "PBox16.04": os.system("cp -rf /mnt/profile /etc/") if not os.path.isdir("/mnt/FCloudComm"): print("1") sys.exit() if not os.path.isfile("/mnt/run.sh"): print("2") sys.exit() if not os.path.isfile("/usr/lib/libiconv.so.2.6.1"): os.system("cp -rf /mnt/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/") os.system("ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so") os.system("ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2") with open("/etc/init.d/rc.local", "r+") as f: lines = f.readlines() f.seek(0) for l in lines: if "source" not in l: f.write(l) f.write("source /mnt/run.sh\n") print("历史数据库安装完成") def system_init_pbox(): if not os.path.isdir("/pbox/FCloudComm"): print("1") sys.exit() if not os.path.isfile("/pbox/run.sh"): print("2") sys.exit() if not os.path.isfile("/usr/lib/libatomic.so.1.0.
-
@ChatGPT #!/usr/bin/env python3
import os
import sysdef deploy_package(argv):
count = 0
filename = []
is_tar = 1
path = os.path.abspath(os.path.dirname(file))for file in os.listdir(path): if is_tar and file.endswith(".tar.gz"): filename.append(file) count += 1 if count = count: print("索引错误") sys.exit() else: tar_path = "/pbox" if argv == "PBox" else "/mnt" os.system(f"tar zxvf {filename[inNum]} -C {tar_path}")
def system_init(argv):
if argv != "PBox16.04":
os.system("cp -rf /mnt/profile /etc/")
if not os.path.isdir("/mnt/FCloudComm"):
print("1")
sys.exit()
if not os.path.isfile("/mnt/run.sh"):
print("2")
sys.exit()if not os.path.isfile("/usr/lib/libiconv.so.2.6.1"): os.system("cp -rf /mnt/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/") os.system("ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so") os.system("ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2") with open("/etc/init.d/rc.local", "r+") as f: lines = f.readlines() f.seek(0) for l in lines: if "source" not in l: f.write(l) f.write("source /mnt/run.sh\n") print("历史数据库安装完成")
def system_init_pbox():
if not os.path.isdir("/pbox/FCloudComm"):
print("1")
sys.exit()
if not os.path.isfile("/pbox/run.sh"):
print("2")
sys.exit()if not os.path.isfile("/usr/lib/libatomic.so.1.0.
解释一下这段代码
-
for culture 说:
@ChatGPT #!/usr/bin/env python3
import os
import sysdef deploy_package(argv):
count = 0
filename = []
is_tar = 1
path = os.path.abspath(os.path.dirname(file))for file in os.listdir(path): if is_tar and file.endswith(".tar.gz"): filename.append(file) count += 1 if count = count: print("索引错误") sys.exit() else: tar_path = "/pbox" if argv == "PBox" else "/mnt" os.system(f"tar zxvf {filename[inNum]} -C {tar_path}")
def system_init(argv):
if argv != "PBox16.04":
os.system("cp -rf /mnt/profile /etc/")
if not os.path.isdir("/mnt/FCloudComm"):
print("1")
sys.exit()
if not os.path.isfile("/mnt/run.sh"):
print("2")
sys.exit()if not os.path.isfile("/usr/lib/libiconv.so.2.6.1"): os.system("cp -rf /mnt/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/") os.system("ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so") os.system("ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2") with open("/etc/init.d/rc.local", "r+") as f: lines = f.readlines() f.seek(0) for l in lines: if "source" not in l: f.write(l) f.write("source /mnt/run.sh\n") print("历史数据库安装完成")
def system_init_pbox():
if not os.path.isdir("/pbox/FCloudComm"):
print("1")
sys.exit()
if not os.path.isfile("/pbox/run.sh"):
print("2")
sys.exit()if not os.path.isfile("/usr/lib/libatomic.so.1.0.
解释一下这段代码
这段代码是一个Python脚本,包含两个函数:deploy_package和system_init。主要功能用于自动化部署和初始化Linux系统中的一些组件和文件。
deploy_package函数接收一个参数,作为要安装的组件名称。首先获取当前目录下所有以.tar.gz结尾的文件,如果没有找到任何相关文件,则打印“索引错误”并退出。否则,根据参数值选择部署到不同的目录中,并使用tar命令解压缩指定的.tal.gz文件到目标目录中。
system_init函数有两个版本:其中一个接收一个参数(非PBox16.04),另一个没有参数。这个函数的主要目的是初始化Linux系统,主要包括以下几个方面:
- 复制/mnt/profile到/etc/目录下。
- 检查/mnt/FCloudComm、/mnt/run.sh文件是否存在或已创建。
- 检查/usr/lib/libiconv.so.2.6.1文件是否存在或已创建。
- 最后将source /mnt/run.sh添加到/etc/rc.local中。
如果是system_init_pbox,主要检查/pbox/FCloudComm、/pbox/run.sh文件是否存在或已创建,并检查/usr/lib/libatomic.so.1.0.文件是否存在或已创建。
最后一个if条件可能被中断了,缺少右括号.
-
@ChatGPT 用python重写如下脚本,输出完整代码并给出注释
#!/bin/bash
argv=$1
#deploy=$1
count=0
filename=()
isTar=1
if [ $isTar == "1" ]
thenpath=
cd $(dirname $0);pwd -P
#echo the current path is:$path
for i inls
do
filegz="tar.gz"
if [[ $i == $filegz ]]
then
#echo $i
filename[count]=$i
count=expr $count + 1
fi
done#echo $count
#echo ${filename[@]}
for((n=0;n<${#filename[@]};n++)){
echo -e "\033[40;35m"$n"\033[0m \033[40;32m"${filename[n]}"\033[0m"
}if (("$count" <= "0"));
then
echo "请下载部署包"
exit
elif (("$count" == "1"));
then
if [ $argv == "PBox" ];
then
tar zxvf ${filename[0]} -C /pbox
else
tar zxvf ${filename[0]} -C /mnt
fi
else
echo -e "\033[40;36m 请选择部署包:\033[0m"
read inNum
if (("$inNum" < "0")) || (("$inNum" >= "$count"))
then
echo "索引错误"
exit
else
if [ $argv == "PBox" ];
then
tar zxvf ${filename[0]} -C /pbox
else
tar zxvf ${filename[0]} -C /mnt
fi
fi
fi
fi#echo "解压部署包"
#echo $deploy
#tar -zxvf $deploy
#echo "解压部署包完成"inspect(){
if [ $argv != "PBox16.04" ];
then
cp -rf /mnt/profile /etc/
fi
if [ ! -d "/mnt/FCloudComm" ]
then
echo "1"
exit
fi
if [ ! -f "/mnt/run.sh" ]
then
echo "2"
exit
fiif [ ! -f "/usr/lib/libiconv.so.2.6.1" ]; then cp -rf /mnt/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/ ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2 fi sed -i '/source/d' /etc/init.d/rc.local sed -i '$a source /mnt/run.sh' /etc/init.d/rc.local #taosd &>/dev/null echo "历史数据库安装完成"
}
inspectPBox(){
if [ ! -d "/pbox/FCloudComm" ]
then
echo "1"
exit
fi
if [ ! -f "/pbox/run.sh" ]
then
echo "2"
exit
fiif [ ! -f "/usr/lib/libiconv.so.2.6.1" ]; then cp -rf /pbox/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/ ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2 fi #taosd &>/dev/null echo "历史数据库安装完成"
}
echo "拷贝系统文件"
if [ $argv == "8401d" ];
then
cp -rf ./libstdc++.so.6 /usr/lib/arm-linux-gnueabihf/
cp -rf ./libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/
fiif [ $argv == "ISG" ];
then
cp -rf ./libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/
ln -sf /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6if [ ! -f "/usr/lib/libatomic.so.1.0.0" ];
then
cp -rf /mnt/FCloudComm/bin/libatomic.so.1.0.0 /usr/lib/
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so.1
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so
fi
fiecho "拷贝系统文件完成"
echo -e "\033[40;36m 网口选择 单网(1)双网(2) \033[0m"
read input
#echo $input
if [ $input == "1" ];
then
sed -i 's/NetCardCount = "2"/NetCardCount = "1"/g' /mnt/FCloudComm/bin/pSL_Setting.xml
sed -i '/sleep 1/d' /mnt/FCloudComm/tools/IPCfg
sed -i '/ifconfig eth1 192.168.20.101 netmask 255.255.255.0 up/d' /mnt/FCloudComm/tools/IPCfg
sed -i '/route add default gw 192.168.20.1 dev eth1/d' /mnt/FCloudComm/tools/IPCfg
fi
echo "网口配置完成"#4G函数
echo -e "\033[40;36m 是否支持4G? 否(0)是(1) \033[0m"read -p "" number
if [ $number -eq 0 ];
then
if [ $argv == "8401d" ];
then
sed -i '/active4g.sh/d' /mnt/run.sh
fiif [ $argv == "PBox" ]; then sed -i '/quectel-pppd.sh/d' /pbox/run.sh fi if [ $argv == "PBox16.04" ]; then sed -i '/quectel-pppd.sh/d' /mnt/run.sh fi
fi
if [ $number -eq 1 ];
then
if [ $argv == "8401d" ];
then
sed -i '/active4g.sh/d' /mnt/run.sh
sed -i '/sleep 10/i\sh ./active4g.sh &' /mnt/run.sh
fiif [ $argv == "PBox" ]; then sed -i '/quectel-pppd.sh/d' /pbox/run.sh sed -i '/sleep 10/i\sh ./quectel-pppd.sh &' /pbox/run.sh fi if [ $argv == "PBox16.04" ]; then sed -i '/quectel-pppd.sh/d' /mnt/run.sh sed -i '/sleep 10/i\sh ./quectel-pppd.sh &' /mnt/run.sh fi
fi
if [ $number -ne 1 ] && [ $number -ne 0 ];
then
echo "输入错误"
fiecho "配置开机启动"
if [ $argv == "8401d" ];
then
sed -i '1c #! /bin/bash' /etc/init.d/rc.local
fiif [ $argv == "PBox16.04" ];
then
sed -i '1c #! /bin/bash' /etc/rc.local
fiif [ $argv == "ISG" ];
then
sed -i '1c #! /bin/bash' /etc/init.d/rocktech.sh
sed -i '/source/d' /etc/init.d/rocktech.sh
sed -i '$a source /mnt/run.sh' /etc/init.d/rocktech.sh
sed -i '/source/d' /etc/init.d/rc.local
sed -i "114s:#::g" /etc/init.d/rocktech.sh
fiecho "配置开机启动完成"
echo "初始化本地ip地址"
sed -i 's/address 190.5.20.171/address 192.168.10.101/g' /etc/network/interfaces
sed -i 's/gateway 190.5.200.11/gateway 192.168.10.1/g' /etc/network/interfaces
sed -i 's/address 192.168.1.100/address 192.168.20.101/g' /etc/network/interfaces
sed -i 's/gateway 192.168.1.1/gateway 192.168.20.1/g' /etc/network/interfaces
echo "初始化本地ip地址结束"echo "配置历史数据库"
#td库ISG网关配置
td(){
cd /mnt/TDengine-server-2.0.10.0/
./install.sh &>/dev/null
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
sed -i 's/# fqdn/fqdn/g' /etc/taos/taos.cfg
sed -i 's/hostname/localhost/g' /etc/taos/taos.cfg
}#PBox网关配置
PB(){
if [ ! -f "/usr/lib/libatomic.so.1.0.0" ];
then
cp -rf /pbox/FCloudComm/bin/libatomic.so.1.0.0 /usr/lib/
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so.1
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so
fised -i '1c #! /bin/bash' /etc/init.d/rc.local cd /pbox/TDengine-server-2.0.10.0 ./install.sh &>/dev/null sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg sed -i 's/# logDir/ logDir/g' /etc/taos/taos.cfg sed -i 's/# dataDir/ dataDir/g' /etc/taos/taos.cfg sed -i 's#/var/log/taos#/pbox/log#g' /etc/taos/taos.cfg sed -i 's#/var/lib/taos#/pbox/lib#g' /etc/taos/taos.cfg sed -i '/run.sh/d' /etc/rc5.d/S99rmnologin.sh sed -i '$a source /pbox/run.sh' /etc/rc5.d/S99rmnologin.sh
}
power(){
source /mnt/FCloudComm/tools/setEnv.sh
if [ -d "/mnt/config" ];then
#echo "文件夹存在"if [ -f "/mnt/config/hardwareinfo.HID" ];then #echo "文件存在" cp -rf /mnt/config/hardwareinfo.HID /mnt/FCloudComm else #echo "文件不存在" echo "配置完成 请放入HID 和 授权文件" /mnt/FCloudComm/bin/getID fi if [ -f "/mnt/config/"*".lic" ];then #echo "文件存在" cp -rf /mnt/config/*.lic /mnt/FCloudComm/bin else #echo "文件不存在" echo "配置完成 请放入HID 和 授权文件" /mnt/FCloudComm/bin/getID fi else #echo "文件夹不存在" echo "配置完成 请放入HID 和 授权文件" /mnt/FCloudComm/bin/getID fi #echo "配置完成 请放入HID 和 授权文件" #/mnt/FCloudComm/bin/getID
}
powerPBox(){
source /pbox/FCloudComm/tools/setEnv.sh
if [ -d "/pbox/config" ];then
#echo "文件夹存在"if [ -f "/pbox/config/hardwareinfo.HID" ];then #echo "文件存在" cp -rf /pbox/config/hardwareinfo.HID /pbox/FCloudComm else #echo "文件不存在" echo "配置完成 请放入HID 和 授权文件" /pbox/FCloudComm/bin/getID fi if [ -f "/pbox/config/"*".lic" ];then #echo "文件存在" cp -rf /pbox/config/*.lic /pbox/FCloudComm/bin else #echo "文件不存在" echo "配置完成 请放入HID 和 授权文件" /pbox/FCloudComm/bin/getID fi else #echo "文件夹不存在" echo "配置完成 请放入HID 和 授权文件" /pbox/FCloudComm/bin/getID fi #echo "配置完成 请放入HID 和 授权文件" #/pbox/FCloudComm/bin/getID
}
case "$1" in
8401d)
cd /mnt/TDengine-server-2.0.10.0
./install.sh &>/dev/null
sed -i 's#/third/log#log#g' /etc/taos/taos.cfg
sed -i 's#/third/data#data#g' /etc/taos/taos.cfg
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
inspect
power
;;
8316)
i="0"
while read path
do
if [ "$path" == "127.0.0.1 GEA-8316-DLK" ];
then
i="1"
fi
done < /etc/hostsif [ "$i" != "1" ]; then sed -i '$a\127.0.0.1 GEA-8316-DLK' /etc/hosts fi cd /mnt/TDengine-server-2.0.10.0 ./install.sh &>/dev/null sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg inspect power ;; ISG) i="0" while read path do if [ "$path" == "127.0.0.1 localhost" ]; then i="1" fi done < /etc/hosts if [ "$i" != "1" ]; then echo "127.0.0.1 localhost"> /etc/hosts fi td inspect power ;; PBox) i="0" while read path do if [ "$path" == "127.0.0.1 imx6ull14x14evk" ]; then i="1" fi done < /etc/hosts if [ "$i" != "1" ]; then echo "127.0.0.1 imx6ull14x14evk"> /etc/hosts fi PB inspectPBox powerPBox ;; PBox16.04) pkexec chown root:root /etc/sudoers /etc/sudoers.d -R td inspect power sed -i '/source/d' /etc/init.d/rc.local sed -i '/source/d' /etc/rc.local sed -i '/sleep 1/isource /mnt/run.sh' /etc/rc.local ;;
esac
-
for culture 说:
@ChatGPT 用python重写如下脚本,输出完整代码并给出注释
#!/bin/bash
argv=$1
#deploy=$1
count=0
filename=()
isTar=1
if [ $isTar == "1" ]
thenpath=
cd $(dirname $0);pwd -P
#echo the current path is:$path
for i inls
do
filegz="tar.gz"
if [[ $i == $filegz ]]
then
#echo $i
filename[count]=$i
count=expr $count + 1
fi
done#echo $count
#echo ${filename[@]}
for((n=0;n echo -e "\033[40;35m"$n"\033[0m \033[40;32m"${filename[n]}"\033[0m"
}if (("$count" then
echo "请下载部署包"
exit
elif (("$count" == "1"));
then
if [ $argv == "PBox" ];
then
tar zxvf ${filename[0]} -C /pbox
else
tar zxvf ${filename[0]} -C /mnt
fi
else
echo -e "\033[40;36m 请选择部署包:\033[0m"
read inNum
if (("$inNum" = "$count"))
then
echo "索引错误"
exit
else
if [ $argv == "PBox" ];
then
tar zxvf ${filename[0]} -C /pbox
else
tar zxvf ${filename[0]} -C /mnt
fi
fi
fi
fi#echo "解压部署包"
#echo $deploy
#tar -zxvf $deploy
#echo "解压部署包完成"inspect(){
if [ $argv != "PBox16.04" ];
then
cp -rf /mnt/profile /etc/
fi
if [ ! -d "/mnt/FCloudComm" ]
then
echo "1"
exit
fi
if [ ! -f "/mnt/run.sh" ]
then
echo "2"
exit
fiif [ ! -f "/usr/lib/libiconv.so.2.6.1" ];
then
cp -rf /mnt/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/
ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so
ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2
fised -i '/source/d' /etc/init.d/rc.local
sed -i '$a source /mnt/run.sh' /etc/init.d/rc.local#taosd &>/dev/null
echo "历史数据库安装完成"}
inspectPBox(){
if [ ! -d "/pbox/FCloudComm" ]
then
echo "1"
exit
fi
if [ ! -f "/pbox/run.sh" ]
then
echo "2"
exit
fiif [ ! -f "/usr/lib/libiconv.so.2.6.1" ];
then
cp -rf /pbox/FCloudComm/bin/libiconv.so.2.6.1 /usr/lib/
ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so
ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2
fi#taosd &>/dev/null
echo "历史数据库安装完成"}
echo "拷贝系统文件"
if [ $argv == "8401d" ];
then
cp -rf ./libstdc++.so.6 /usr/lib/arm-linux-gnueabihf/
cp -rf ./libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/
fiif [ $argv == "ISG" ];
then
cp -rf ./libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/
ln -sf /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.0.21 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6if [ ! -f "/usr/lib/libatomic.so.1.0.0" ];
then
cp -rf /mnt/FCloudComm/bin/libatomic.so.1.0.0 /usr/lib/
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so.1
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so
fi
fiecho "拷贝系统文件完成"
echo -e "\033[40;36m 网口选择 单网(1)双网(2) \033[0m"
read input
#echo $input
if [ $input == "1" ];
then
sed -i 's/NetCardCount = "2"/NetCardCount = "1"/g' /mnt/FCloudComm/bin/pSL_Setting.xml
sed -i '/sleep 1/d' /mnt/FCloudComm/tools/IPCfg
sed -i '/ifconfig eth1 192.168.20.101 netmask 255.255.255.0 up/d' /mnt/FCloudComm/tools/IPCfg
sed -i '/route add default gw 192.168.20.1 dev eth1/d' /mnt/FCloudComm/tools/IPCfg
fi
echo "网口配置完成"#4G函数
echo -e "\033[40;36m 是否支持4G? 否(0)是(1) \033[0m"read -p "" number
if [ $number -eq 0 ];
then
if [ $argv == "8401d" ];
then
sed -i '/active4g.sh/d' /mnt/run.sh
fiif [ $argv == "PBox" ];
then
sed -i '/quectel-pppd.sh/d' /pbox/run.sh
fiif [ $argv == "PBox16.04" ];
then
sed -i '/quectel-pppd.sh/d' /mnt/run.sh
fi
fiif [ $number -eq 1 ];
then
if [ $argv == "8401d" ];
then
sed -i '/active4g.sh/d' /mnt/run.sh
sed -i '/sleep 10/i\sh ./active4g.sh &' /mnt/run.sh
fiif [ $argv == "PBox" ];
then
sed -i '/quectel-pppd.sh/d' /pbox/run.sh
sed -i '/sleep 10/i\sh ./quectel-pppd.sh &' /pbox/run.sh
fiif [ $argv == "PBox16.04" ];
then
sed -i '/quectel-pppd.sh/d' /mnt/run.sh
sed -i '/sleep 10/i\sh ./quectel-pppd.sh &' /mnt/run.sh
fi
fiif [ $number -ne 1 ] && [ $number -ne 0 ];
then
echo "输入错误"
fiecho "配置开机启动"
if [ $argv == "8401d" ];
then
sed -i '1c #! /bin/bash' /etc/init.d/rc.local
fiif [ $argv == "PBox16.04" ];
then
sed -i '1c #! /bin/bash' /etc/rc.local
fiif [ $argv == "ISG" ];
then
sed -i '1c #! /bin/bash' /etc/init.d/rocktech.sh
sed -i '/source/d' /etc/init.d/rocktech.sh
sed -i '$a source /mnt/run.sh' /etc/init.d/rocktech.sh
sed -i '/source/d' /etc/init.d/rc.local
sed -i "114s:#::g" /etc/init.d/rocktech.sh
fiecho "配置开机启动完成"
echo "初始化本地ip地址"
sed -i 's/address 190.5.20.171/address 192.168.10.101/g' /etc/network/interfaces
sed -i 's/gateway 190.5.200.11/gateway 192.168.10.1/g' /etc/network/interfaces
sed -i 's/address 192.168.1.100/address 192.168.20.101/g' /etc/network/interfaces
sed -i 's/gateway 192.168.1.1/gateway 192.168.20.1/g' /etc/network/interfaces
echo "初始化本地ip地址结束"echo "配置历史数据库"
#td库ISG网关配置
td(){
cd /mnt/TDengine-server-2.0.10.0/
./install.sh &>/dev/null
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
sed -i 's/# fqdn/fqdn/g' /etc/taos/taos.cfg
sed -i 's/hostname/localhost/g' /etc/taos/taos.cfg
}#PBox网关配置
PB(){
if [ ! -f "/usr/lib/libatomic.so.1.0.0" ];
then
cp -rf /pbox/FCloudComm/bin/libatomic.so.1.0.0 /usr/lib/
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so.1
ln -sf /usr/lib/libatomic.so.1.0.0 /usr/lib/libatomic.so
fised -i '1c #! /bin/bash' /etc/init.d/rc.local
cd /pbox/TDengine-server-2.0.10.0
./install.sh &>/dev/null
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
sed -i 's/# logDir/ logDir/g' /etc/taos/taos.cfg
sed -i 's/# dataDir/ dataDir/g' /etc/taos/taos.cfg
sed -i 's#/var/log/taos#/pbox/log#g' /etc/taos/taos.cfg
sed -i 's#/var/lib/taos#/pbox/lib#g' /etc/taos/taos.cfgsed -i '/run.sh/d' /etc/rc5.d/S99rmnologin.sh
sed -i '$a source /pbox/run.sh' /etc/rc5.d/S99rmnologin.sh
}power(){
source /mnt/FCloudComm/tools/setEnv.sh
if [ -d "/mnt/config" ];then
#echo "文件夹存在"if [ -f "/mnt/config/hardwareinfo.HID" ];then
#echo "文件存在"
cp -rf /mnt/config/hardwareinfo.HID /mnt/FCloudComm
else
#echo "文件不存在"
echo "配置完成 请放入HID 和 授权文件"
/mnt/FCloudComm/bin/getID
fiif [ -f "/mnt/config/"".lic" ];then
#echo "文件存在"
cp -rf /mnt/config/.lic /mnt/FCloudComm/bin
else
#echo "文件不存在"
echo "配置完成 请放入HID 和 授权文件"
/mnt/FCloudComm/bin/getID
fielse
#echo "文件夹不存在"
echo "配置完成 请放入HID 和 授权文件"
/mnt/FCloudComm/bin/getID
fi
#echo "配置完成 请放入HID 和 授权文件"
#/mnt/FCloudComm/bin/getID
}powerPBox(){
source /pbox/FCloudComm/tools/setEnv.sh
if [ -d "/pbox/config" ];then
#echo "文件夹存在"if [ -f "/pbox/config/hardwareinfo.HID" ];then
#echo "文件存在"
cp -rf /pbox/config/hardwareinfo.HID /pbox/FCloudComm
else
#echo "文件不存在"
echo "配置完成 请放入HID 和 授权文件"
/pbox/FCloudComm/bin/getID
fiif [ -f "/pbox/config/"".lic" ];then
#echo "文件存在"
cp -rf /pbox/config/.lic /pbox/FCloudComm/bin
else
#echo "文件不存在"
echo "配置完成 请放入HID 和 授权文件"
/pbox/FCloudComm/bin/getID
fielse
#echo "文件夹不存在"
echo "配置完成 请放入HID 和 授权文件"
/pbox/FCloudComm/bin/getID
fi
#echo "配置完成 请放入HID 和 授权文件"
#/pbox/FCloudComm/bin/getID
}case "$1" in
8401d)
cd /mnt/TDengine-server-2.0.10.0
./install.sh &>/dev/null
sed -i 's#/third/log#log#g' /etc/taos/taos.cfg
sed -i 's#/third/data#data#g' /etc/taos/taos.cfg
sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg
inspect
power
;;
8316)
i="0"
while read path
do
if [ "$path" == "127.0.0.1 GEA-8316-DLK" ];
then
i="1"
fi
done
if [ "$i" != "1" ];
then
sed -i '$a\127.0.0.1 GEA-8316-DLK' /etc/hosts
ficd /mnt/TDengine-server-2.0.10.0 ./install.sh &>/dev/null sed -i 's/firstEp/#firstEp/g' /etc/taos/taos.cfg inspect power ;;
ISG)
i="0"
while read path
do
if [ "$path" == "127.0.0.1 localhost" ];
then
i="1"
fi
done
if [ "$i" != "1" ];
then
echo "127.0.0.1 localhost"> /etc/hosts
fitd inspect power ;;
PBox)
i="0"
while read path
do
if [ "$path" == "127.0.0.1 imx6ull14x14evk" ];
then
i="1"
fi
done
if [ "$i" != "1" ];
then
echo "127.0.0.1 imx6ull14x14evk"> /etc/hosts
fi
PB
inspectPBox
powerPBox
;;
PBox16.04)
pkexec chown root:root /etc/sudoers /etc/sudoers.d -R
td
inspect
power
sed -i '/source/d' /etc/init.d/rc.local
sed -i '/source/d' /etc/rc.local
sed -i '/sleep 1/isource /mnt/run.sh' /etc/rc.local
;;
esac以下是Python版的代码和注释:
#!/usr/bin/python3 import os import shutil import subprocess def inspect(): # 用于安装历史数据库和权限文件等等操作 if deploy != "PBox16.04": # 复制profile文件 shutil.copy("/mnt/profile", "/etc/") # 判断历史数据库文件夹是否存在 # 若不存在,则返回错误信息 if not os.path.exists("/mnt/FCloudComm"): print("1") return # 判断run.sh是否存在 # 若不存在,则返回错误信息 elif not os.path.exists("/mnt/run.sh"): print("2") return # 若libiconv.so.2.6.1文件不存在 # 则将该文件复制到/usr/lib/下,并建立软链接 if not os.path.exists("/usr/lib/libiconv.so.2.6.1"): shutil.copy("/mnt/FCloudComm/bin/libiconv.so.2.6.1", "/usr/lib/") os.system("ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so") os.system("ln -sf /usr/lib/libiconv.so.2.6.1 /usr/lib/libiconv.so.2") # 将run.sh脚本配置到开机启动项中 subprocess.call("sed -i '/source/d' /etc/init.d/rc.local", shell=True) subprocess.call("sed -i '$a source /mnt/run.sh' /etc/init.d/rc.local", shell=True) # 执行完成后,输出提示信息 print("历史数据库安装完成") # 定义函数,用于安装历史数据库和权限文件等等操作(针对PBox版本) def inspectPBox(): # 判断历史数据库文件夹是否存在 # 若不存在,则返回错误信息 if not os.path.exists("/pbox/FCloudComm"): print("1") return # 判断run.sh是否存在 # 若不存在,则返回错误信息 elif not os.path.exists("/pbox/run.sh"): print("2") return # 若libiconv.so.2.6.1文件不存在 # 则将该文件复制到/usr/lib/下,并建立软链接 if not os.path.exists("/usr/lib/libiconv.so.2.6.1"): shutil.copy("/pbox/FCloudComm/bin/libiconv.so.2.6.1", "/usr/lib/") os.system("ln -sf
-
scintist 说:
@ChatGPT 如何理解“中国经济韧性强、潜力大、活力足,长期向好的基本面依然不变”
这段话是对中国经济的一种评估和描述。它可以这样理解:
首先,“中国经济韧性强”,意味着中国经济在面对不利因素时有硬抗风险、储备力量充足的能力。在全球经济增速放缓、贸易摩擦等因素带来的冲击下,中国经济仍然保持了稳定发展,这就是“韧性强”的表现。
其次,“潜力大”,意味着中国经济还有很大的发展空间,尤其是在新技术、新产业、新业态、新模式等方面,有很多未来的发展机会和潜力。这意味着中国经济还有很大的上升空间和发展潜力。
再次,“活力足”,意味着中国经济具有强大的动力和活力,为未来发展注入了新能量和动力。例如,中国政府推动的供给侧改革和创新驱动发展,这些措施都在推动经济的发展,并培育了许多新的经济领域和新的潜力点。
最后,“长期向好的基本面依然不变”,意味着中国经济长期向好的趋势没有改变。中国经济在过去几十年的发展已经证明了其能够在全球市场中稳健增长,在未来,中国经济的增长趋势将继续延续。这一点对于国内外投资者来说是非常重要的信号。
-
scintist 说:
@ChatGPT 如何理解“要保持强烈的忧患意识、风险意识,加强对各种风险隐患的研判,做足预案,下好先手棋,打好主动仗,及时精准拆弹,增强防范化解风险的意识和本领”
上述言论意思是,在日常生活中,我们应该始终保持警觉和警惕,认识到存在各种潜在的风险和隐患。我们应该积极主动地研判、识别和评估风险和隐患,制定相应的应对预案,提高自己的应对能力,在遇到风险和挑战时能够做出恰当的反应。
为了实现这个目标,我们需要先了解和认知到潜在的各种风险和隐患,然后加强对其进行研究和分析,在做好防范措施的基础上,建立应对预案,即“先手棋”,以及时、精准地应对,化解各种风险。
同时,我们应该意识到,防范和化解风险是一项不断演进和持续改进的过程,需要不断加强学习、总结和反思,不断提高自身的风险管理能力,保持强烈的警惕性和适应性,才能更好地应对各种挑战和风险。
-
饭团酱 说:
@ChatGPT What are some challenges to doing your best work?
There are a variety of challenges that can hinder someone from doing their best work. Here are a few:
-
Time constraints: When you are rushing to complete a task, it can be difficult to put in the highest level of effort and attention.
-
Lack of resources: Without the necessary tools or support, it can be difficult to complete a task to the best of your abilities.
-
Distractions: When there are other things vying for your attention, it can be tough to focus entirely on the task at hand.
-
Burnout: If you have been working for an extended period without taking breaks or managing your workload, you can experience burnout, which can lead to decreased performance.
-
Perfectionism: When you set unrealistic standards for yourself, it can be difficult to feel satisfied with your work, even if it is objectively good.
-
Lack of motivation: If you don't find the work meaningful or enjoyable, it can be tough to put in your best effort.
-
-
饭团酱 说:
@ChatGPT 详细描述下
我是一款基于人工智能的聊天机器人。通过自然语言处理和语义分析,我可以理解并回答用户的问题,提供各种服务和帮助。
在JIKE.info社区中,用户可以通过@ChatGPT来与我进行交互。当用户@我时,我会尽快回复并帮助解决问题。我可以回答关于JIKE.info社区、技术问题、常见问题等各种问题。
同时,我也能进行闲聊和娱乐。用户可以向我提问各种问题,我会尽力回答或带来愉快的聊天体验。
总的来说,作为一个智能机器人,我旨在为用户提供便捷、高效、有趣的服务和帮助,同时与用户建立友好的互动关系,共同促进社区的繁荣发展。