Lynx
Senior Member
Just wondering - do most people regularly backup their JFFS / USB config?
I created the following simple backup script to upload router config and tarballs of JFFS and the USB mount to OneDrive, which script could in theory be called every boot. But I am dubious that that is necessary?
Script updated in the light of comment(s) below.
I created the following simple backup script to upload router config and tarballs of JFFS and the USB mount to OneDrive, which script could in theory be called every boot. But I am dubious that that is necessary?
Script updated in the light of comment(s) below.
Code:
#!/bin/bash
log_file="/mnt/SanDisk/upload-router-config-log.txt"
usb_dir="/mnt/SanDisk"
rclone_config_file="/jffs/configs/rclone_config"
upload_dir="OneDrive:/Scripts/ASUS Router/Router Config"
rclone_exclude_file=/jffs/scripts/rclone_exclude
FWVER="$(nvram get buildno 2>/dev/null)"
df -h /jffs "$usb_dir"
echo "Skipping the following files:"
du -h /mnt/SanDisk/$(cat "$rclone_exclude_file")
echo "Backing up router config ..."
nvram save "$usb_dir"/cfg_"$FWVER".cfg
if rclone --config "$rclone_config_file" move "$usb_dir"/cfg_"$FWVER".cfg "$upload_dir" >"$log_file" 2>&1; then
echo "... router config backup complete."
fi
echo "Backing up JFFS ..."
if tar -cf - -C /jffs . | rclone --cache-writes --cache-dir "$usb_dir" --config "$rclone_config_file" rcat "$upload_dir"/jffs_"$FWVER".tar >"$log_file" 2>&1; then
echo "... JFFS backup complete."
fi
echo "Backing up USB ..."
if tar -czf - -C "$usb_dir" . -X "$rclone_exclude_file" | rclone --cache-writes --cache-dir "$usb_dir" --config "$rclone_config_file" rcat "$upload_dir"/usb_"$FWVER".tar.gz >"$log_file" 2>&1; then
echo "... USB backup complete."
Last edited: