mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
46 lines
789 B
Bash
46 lines
789 B
Bash
#!/bin/bash -eu
|
|
|
|
export LOG_FILE=/tmp/archive-teslacam-clips.log
|
|
export ARCHIVE_MOUNT=/mnt/archive
|
|
|
|
function log () {
|
|
echo "$( date )" >> "$LOG_FILE"
|
|
echo "$1" >> "$LOG_FILE"
|
|
}
|
|
|
|
function disconnect_usb_drives_from_host () {
|
|
log "Disconnecting usb from host..."
|
|
modprobe -r g_mass_storage
|
|
log "Disconnected usb from host."
|
|
}
|
|
|
|
export -f log
|
|
|
|
log "Starting..."
|
|
|
|
if [ -r "/root/.teslaCamRsyncConfig" ]
|
|
then
|
|
/root/bin/connect-archive-rsync.sh
|
|
else
|
|
/root/bin/connect-archive-cifs.sh
|
|
fi
|
|
|
|
disconnect_usb_drives_from_host
|
|
|
|
ensure_cam_file_is_mounted
|
|
|
|
fix_errors_in_cam_file
|
|
|
|
/root/bin/archive-clips.sh
|
|
|
|
if [ -r "/root/.teslaCamRsyncConfig" ]
|
|
then
|
|
/root/bin/disconnect-archive-rsync.sh
|
|
else
|
|
/root/bin/disconnect-archive-cifs.sh
|
|
fi
|
|
|
|
unmount_cam_file
|
|
|
|
connect_usb_drives_to_host
|