All pastes #637907 Raw Edit

Vermischtes

public text v1 · immutable
#637907 ·published 2007-07-29 10:34 UTC
rendered paste body
#!/bin/sh
#
# OpenWRT-based router backup script for rsnapshot
# Copyright (c) 2007 Pieter Hollants <suserpms@hollants.com>
# This file is free software licensed under the GNU Public License (GPL) v2.
#
# This script backups data from the specified OpenWRT-based router,
# including nvram variables, the ipkg package list and the JFFS2 partition.
#
# NOTE: make sure that the user this script runs under has passwordless SSH
#       access to the router!

HOST=$1

if [ -z "$HOST" ] ; then
  echo "Usage: $0 <hostname or IP>"
  exit
fi

mkdir -p $HOST

ssh root@$HOST "[ -e /usr/sbin/nvram ] && /usr/sbin/nvram show 2>/dev/null" | sort >$HOST/nvram.txt
ssh root@$HOST "/usr//bin/ipkg list_installed" >$HOST/pkglist.txt
sed -i '/Done./d' $HOST/pkglist.txt
ssh root@$HOST "cd /jffs && /bin/tar c - *" >$HOST/jffs.tar 2>/dev/null
[ -f $HOST/jffs.tar.bz2 ] && rm $HOST/jffs.tar.bz2
bzip2 $HOST/jffs.tar