发表于:2023/11/27 11:10:11
#0楼
打开linux控制器中/etc/rc.local文件,将第一行#!/bin/sh -e修改为#!/bin/sh,在最后一行exit 0前添加要执行的语句。
注:若执行的程序需要依赖zmotion.lib库,则需加5s延迟
例子:VPLC516E控制器需开机执行/home/zmotion/test程序,修改/etc/rc.local后内容如下所示
#!/bin/sh
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
chmod 777 /dev/ttyS*
dev="/dev/ttyUSB3"
if [ -c "$dev" ];then
sleep 3s
pppd call quectel-ppp &
else
echo "no exit ttyUSB"
fi
df | grep "4515168" | grep "root"
if [ $? -eq 0 ];then
resize2fs /dev/mmcblk1p8
else
echo
fi
sleep 5
/home/zmotion/test &
exit 0
注:若执行的程序需要依赖zmotion.lib库,则需加5s延迟
例子:VPLC516E控制器需开机执行/home/zmotion/test程序,修改/etc/rc.local后内容如下所示
#!/bin/sh
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
chmod 777 /dev/ttyS*
dev="/dev/ttyUSB3"
if [ -c "$dev" ];then
sleep 3s
pppd call quectel-ppp &
else
echo "no exit ttyUSB"
fi
df | grep "4515168" | grep "root"
if [ $? -eq 0 ];then
resize2fs /dev/mmcblk1p8
else
echo
fi
sleep 5
/home/zmotion/test &
exit 0