Hi,
I am trying to run some Python code on my Raspberry Pi4 which is started from a sh script that will start on boot up of the Pi. Prior to the code running i automatically mount a memory stick that is already inserted, i'm using this memory stick to save some data that the Python code is collecting. I seem to be having some issues with the initial mounting of the memory stick, as i have a message from a crontab log i have set up that saysThe various steps are as follows:
1) Using crontab -e2) My sh script is as follows:If i run the above script from the CLI, it works.
If i run my code using crontab, but save the data onto the SD card, it works.
If i run my code using crontab and save the data to the memory stick, it doesn't work, and i get the error message above in my cronlog.
As part of a testing process, if i type the command below into a CLIIt seems to mount (i can see the memory stick in the file explorer), however, i get a message saying
I don't seem to get this message using the same command if i run it from boot up via crontab.
I'm a bit confused as to what is going on here. My code works, but doesn't when run from crontab and saving to the memory stick. It looks like there's an issue with the initial mounting of the memory stick and for some reason it's not recognising it when it comes to saving the data.
Does anyone have any thoughts as to what is going on here?
Many thanks
Dave
I am trying to run some Python code on my Raspberry Pi4 which is started from a sh script that will start on boot up of the Pi. Prior to the code running i automatically mount a memory stick that is already inserted, i'm using this memory stick to save some data that the Python code is collecting. I seem to be having some issues with the initial mounting of the memory stick, as i have a message from a crontab log i have set up that says
Code:
'can't open /mnt/usb/data.csv' [Errno 2] No such file or directory '/mnt/usb/data.csv'.
1) Using crontab -e
Code:
@reboot /home/pi1/streaming/code/lauch-stream.sh > /home/pi1/streaming/logs/cronlog 2>&1 &
Code:
#!/bin/shsudo mount /dev/sda1 /mnt/usbcd /cd /home/pi1/streaming/codepython3 streaming.py
If i run my code using crontab, but save the data onto the SD card, it works.
If i run my code using crontab and save the data to the memory stick, it doesn't work, and i get the error message above in my cronlog.
As part of a testing process, if i type the command below into a CLI
Code:
sudo mount /dev/sda1 /mnt/usb
Code:
mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload.
I don't seem to get this message using the same command if i run it from boot up via crontab.
I'm a bit confused as to what is going on here. My code works, but doesn't when run from crontab and saving to the memory stick. It looks like there's an issue with the initial mounting of the memory stick and for some reason it's not recognising it when it comes to saving the data.
Does anyone have any thoughts as to what is going on here?
Many thanks
Dave
Statistics: Posted by cappers — Mon Apr 29, 2024 2:39 pm