使用init.d脚本将文件从USB闪存驱动器复制到系统 [英] Copy files from USB flash drive to system using an init.d script

查看:95
本文介绍了使用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 < span class =code-sdkkeyword>
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...


这篇关于使用init.d脚本将文件从USB闪存驱动器复制到系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆