2013-01-12

Backup using Ccollect and a TomatoUSB router

Ccollect is a pretty simple tool to do incremental backups, and it works easily on a small router with TomatoUSB.

  • install coreutils
  • install openssh
  • create ~/.ssh/config
    nvram setfile2nvram /home/root/.ssh/config
    nvram commit
    
  • to delete:
    nvram unset FILE=/home/root/.ssh/config; nvram commit)
    
  • create a symlink on boot
    • this would not work in the UI admin -> script -> init:
      ln -s /tmp/mnt/OPTWARE/ccollect/ssh_config /home/root/.ssh/config
      
    • but this worked: admin -> scrips -> firewall:
      ln -s /tmp/mnt/OPTWARE/ccollect/ssh_config /home/root/.ssh/config
      
  • ccollect script bk_domain.sh:
#!/bin/sh export PATH="/opt/bin:$PATH"
CCOLLECT_CONF="/tmp/mnt/OPTWARE/ccollect/conf"
/tmp/mnt/OPTWARE/ccollect/ccollect daily domain.name
  • add schedule in admin-sched.asp
    /mnt/OPTWARE/ccollect/bk_domain.sh
    
  • exclude file on local
    /proc /dev /sys /lost+found /bin /boot /initrd /lib /sbin /tmp /usr
    /vmlinuz /vmlinuz.old /var/lib/mysql
    
  • backup mysql in a cron
    01 01 * * * /usr/bin/mysqldump --all-databases | gzip > /backup/folder/mysql-$((RANDOM)).gz
    
  • links

http://www.nico.schottelius.org/software/ccollect/