使用init.d脚本将文件从USB闪存驱动器复制到系统

使用init.d脚本将文件从USB闪存驱动器复制到系统

问题描述:

我正在创建一个linux init脚本,将一些文件从笔式驱动器复制到我的raspberry系统驱动器。但它不会在启动时将文件从笔式驱动器复制到系统。但当我从终端执行它的工作正常。



I am creating a linux init script to copy some files from my pen drive to my raspberry system drive. but its not copying the files from pen drive to system on booting time. but when i executed it from terminal its working fine.

for PENDRIVE in /media/*
	do
		
		if [ -d "$PENDRIVE/Update" ]; then
			INSTALLDIR="$PENDRIVE/Update"
			cp -r $INSTALLDIR /tmp/
			
			chmod a+x /tmp/Update/install.sh
			
			/tmp/Update/install.sh /tmp/Update
		fi
	done







我试过也可以在rc.local中编辑。但它显示错误无法找到要复制的文件...




I tried to edit in rc.local too. But it shows the error cannot find the file to copy...

PENDRIVE / Update];然后
INSTALLDIR =
PENDRIVE/Update" ]; then INSTALLDIR="


PENDRIVE / Update
cp -r
PENDRIVE/Update" cp -r


INSTALLDIR / tmp /

chmod a + x /tmp/Update/install.sh

/tmp/Update/install.sh / tmp /更新
fi
完成
INSTALLDIR /tmp/ chmod a+x /tmp/Update/install.sh /tmp/Update/install.sh /tmp/Update fi done







我也尝试在rc.local中编辑。但它显示错误无法找到要复制的文件...




I tried to edit in rc.local too. But it shows the error cannot find the file to copy...