mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
Merge archive-teslacam-clips into archiveloop.
Now that the archiving of clips has been factored out of archive-teslacam-clips there isn't much value in keeping the template method for archiving in a separate file.
This commit is contained in:
@@ -1,35 +0,0 @@
|
|||||||
#!/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..."
|
|
||||||
|
|
||||||
/root/bin/connect-archive.sh
|
|
||||||
|
|
||||||
disconnect_usb_drives_from_host
|
|
||||||
|
|
||||||
ensure_cam_file_is_mounted
|
|
||||||
|
|
||||||
fix_errors_in_cam_file
|
|
||||||
|
|
||||||
/root/bin/archive-clips.sh
|
|
||||||
|
|
||||||
/root/bin/disconnect-archive.sh
|
|
||||||
|
|
||||||
unmount_cam_file
|
|
||||||
|
|
||||||
connect_usb_drives_to_host
|
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
#!/bin/bash -eu
|
#!/bin/bash -eu
|
||||||
ARCHIVE_HOST_NAME="$1"
|
ARCHIVE_HOST_NAME="$1"
|
||||||
|
|
||||||
LOG_FILE=/tmp/archiveloop.log
|
export LOG_FILE=/tmp/archiveloop.log
|
||||||
|
|
||||||
export CAM_MOUNT=/mnt/cam
|
export CAM_MOUNT=/mnt/cam
|
||||||
export MUSIC_MOUNT=/mnt/music
|
export MUSIC_MOUNT=/mnt/music
|
||||||
|
export ARCHIVE_MOUNT=/mnt/archive
|
||||||
|
|
||||||
function log () {
|
function log () {
|
||||||
echo "$( date )" >> "$LOG_FILE"
|
echo "$( date )" >> "$LOG_FILE"
|
||||||
@@ -154,12 +155,6 @@ function fix_errors_in_music_file () {
|
|||||||
fix_errors_in_mount_point "$MUSIC_MOUNT"
|
fix_errors_in_mount_point "$MUSIC_MOUNT"
|
||||||
}
|
}
|
||||||
|
|
||||||
function archive_clips () {
|
|
||||||
log "Archiving..."
|
|
||||||
/root/bin/archive-teslacam-clips
|
|
||||||
log "Finished archiving."
|
|
||||||
}
|
|
||||||
|
|
||||||
function wait_for_archive_to_be_unreachable () {
|
function wait_for_archive_to_be_unreachable () {
|
||||||
log "Waiting for archive to be unreachable..."
|
log "Waiting for archive to be unreachable..."
|
||||||
while [ true ]
|
while [ true ]
|
||||||
@@ -199,17 +194,47 @@ function mount_and_fix_errors_in_files () {
|
|||||||
mount_and_fix_errors_in_music_file
|
mount_and_fix_errors_in_music_file
|
||||||
}
|
}
|
||||||
|
|
||||||
export -f fix_errors_in_mount_point
|
function disconnect_usb_drives_from_host () {
|
||||||
export -f fix_errors_in_cam_file
|
log "Disconnecting usb from host..."
|
||||||
export -f retry
|
modprobe -r g_mass_storage
|
||||||
|
log "Disconnected usb from host."
|
||||||
|
}
|
||||||
|
|
||||||
|
function archive_teslacam_clips () {
|
||||||
|
log "Starting..."
|
||||||
|
|
||||||
|
/root/bin/connect-archive.sh
|
||||||
|
|
||||||
|
disconnect_usb_drives_from_host
|
||||||
|
|
||||||
|
ensure_cam_file_is_mounted
|
||||||
|
|
||||||
|
fix_errors_in_cam_file
|
||||||
|
|
||||||
|
/root/bin/archive-clips.sh
|
||||||
|
|
||||||
|
/root/bin/disconnect-archive.sh
|
||||||
|
|
||||||
|
unmount_cam_file
|
||||||
|
|
||||||
|
connect_usb_drives_to_host
|
||||||
|
}
|
||||||
|
|
||||||
|
function archive_clips () {
|
||||||
|
log "Archiving..."
|
||||||
|
if archive_teslacam_clips
|
||||||
|
then
|
||||||
|
log "Finished archiving."
|
||||||
|
else
|
||||||
|
log "Archiving failed."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
export -f mount_mountpoint
|
export -f mount_mountpoint
|
||||||
export -f ensure_mountpoint_is_mounted
|
export -f ensure_mountpoint_is_mounted
|
||||||
|
export -f retry
|
||||||
export -f ensure_mountpoint_is_mounted_with_retry
|
export -f ensure_mountpoint_is_mounted_with_retry
|
||||||
export -f ensure_cam_file_is_mounted
|
export -f log
|
||||||
export -f fix_errors_in_cam_file
|
|
||||||
export -f unmount_mount_point
|
|
||||||
export -f unmount_cam_file
|
|
||||||
export -f connect_usb_drives_to_host
|
|
||||||
|
|
||||||
log "Starting..."
|
log "Starting..."
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ function configure_archive_scripts () {
|
|||||||
echo "Configuring the archive scripts..."
|
echo "Configuring the archive scripts..."
|
||||||
|
|
||||||
get_script /root/bin archiveloop run
|
get_script /root/bin archiveloop run
|
||||||
get_script /root/bin archive-teslacam-clips run
|
|
||||||
|
|
||||||
if [ $RSYNC_ENABLE = true ]
|
if [ $RSYNC_ENABLE = true ]
|
||||||
then
|
then
|
||||||
|
|||||||
Reference in New Issue
Block a user