[SOLVED] Mount USB at boot (reboot) and copy file
I am trying to mount a usb immediately after the boot and copy two files on my system.
At the moment I made the folllwing steps:
- creation of the directory /mnt/usb.
creation the following script startup with the following code for the user "pi"
sudo mount /dev/sda1 /mnt/usb -o uid=pi,gid=pi
sudo cp /mnt/usb/interfaces /etc/network/interfaces
sudo cp /mnt/usb/resolv.conf /etc/resolv.conf
if [ -f /mnt/usb/interfaces ]; then
sudo mv /mnt/usb/interfaces /mnt/usb/interfaces.done
if [ -f /mnt/usb/resolv.conf ]; then
sudo mv /mnt/usb/resolv.conf /mnt/usb/resolv.conf.done
Insetion of the script to the crontab file by adding the following row:
The problem is that it does not work.
In the past I made a similar thing on my Raspberry but I cannot find out how to make it.
Note that, of course, we can use different usb stick with the files to be copied on the system.
Eng. Silvano Bertoldo, PhD
- 271 All Categories
- 104 Announcements & News
- 37 Product News - New Product/Product Change Notice/ End-of-life
- 175 Welcome Developers!
- 49 Unboxing & Project Sharing
- 16 Tech Updates
- 259 UP Products
- 21 UP Squared Pro
- 110 UP Xtreme
- 769 UP Squared
- 1.3K UP Board
- 83 UP Core Plus
- 210 UP Core
- 3 UP Xtreme Lite
- 37 UP AI Edge
- 207 Starter Kits & Peripheral