Browse Source

Merge pull request #2799 from mkresin/vnstat

vnstat: allow to restore backup from directory
lilik-openwrt-22.03
Jo-Philipp Wich 9 years ago
parent
commit
763bba37e7
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      net/vnstat/files/vnstat.init

+ 9
- 2
net/vnstat/files/vnstat.init View File

@ -31,7 +31,7 @@ start() {
init_iface() {
local ifn="$1"
[ -n "$url" ] && {
if [ -n "$url" ]; then
local try=0
local max=3
local hostname="$(cat /proc/sys/kernel/hostname)"
@ -45,7 +45,13 @@ start() {
sleep 30
fi
done
}
elif [ -n "$backup_dir" ]; then
if cp -f "$backup_dir/$ifn" "$lib/" &>/dev/null; then
logger -t "vnstat" "Restored backup for database $ifn"
else
logger -t "vnstat" "Restore of backup for database $ifn failed"
fi
fi
/usr/bin/vnstat -u -i "$ifn" >/dev/null
@ -57,6 +63,7 @@ start() {
config_get url "$cfg" remote
config_get lnk "$cfg" symlink
config_get backup_dir "$cfg" backup_dir
config_list_foreach "$cfg" interface init_iface
return 1


Loading…
Cancel
Save