mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
Avoid connecting the USB drive if it'll just immediately be disconnected.
This commit is contained in:
@@ -44,7 +44,7 @@ function move_clips_to_archive () {
|
||||
for file_name in /mnt/usb_share/TeslaCam/saved*; do
|
||||
[ -e "$file_name" ] || continue
|
||||
log "Moving $file_name ..."
|
||||
mv -- "$file_name" /mnt/cam_archive >> "$LOGFILE" 2>&1
|
||||
mv -- "$file_name" /mnt/cam_archive >> "$LOGFILE" 2>&1 || echo ""
|
||||
log "Moved $file_name."
|
||||
done
|
||||
log "Finished moving clips to archive."
|
||||
@@ -56,6 +56,12 @@ function disconnect_usb_from_host () {
|
||||
log "Disconnected usb from host."
|
||||
}
|
||||
|
||||
function fix_errors_on_drive () {
|
||||
log "Running fsck..."
|
||||
/sbin/fsck /mnt/usb_share -- -a >> "$LOGFILE" 2>&1 || echo ""
|
||||
log "Finished running fsck."
|
||||
}
|
||||
|
||||
function mount_usb_drive_locally () {
|
||||
log "Mounting usb locally..."
|
||||
mount /mnt/usb_share
|
||||
@@ -80,22 +86,18 @@ function unmount_usb_share () {
|
||||
log "Unmounted usb share."
|
||||
}
|
||||
|
||||
function connect_usb_to_host() {
|
||||
log "Connecting usb to host..."
|
||||
modprobe g_mass_storage
|
||||
log "Connected usb to host."
|
||||
}
|
||||
|
||||
log "Starting..."
|
||||
|
||||
ensure_cam_archive_is_mounted
|
||||
|
||||
disconnect_usb_from_host
|
||||
|
||||
fix_errors_on_drive
|
||||
|
||||
ensure_usb_share_is_mounted
|
||||
|
||||
move_clips_to_archive
|
||||
|
||||
unmount_usb_share
|
||||
|
||||
connect_usb_to_host
|
||||
connect_usb_to_host
|
||||
Reference in New Issue
Block a user