#!/bin/sh # Save log mkdir -p /usr/lib/ath9k-watchdog UPLOAD_URL='http://[$(uci get configurator.@api[0].ipv6_address)%$(uci get configurator.@api[0].ipv6_interface)]/ath9k-crash/' WGETC=$(which wget) # CD to avoid annoying prefixes cd /usr/lib/ath9k-watchdog #Poll directory every 10 secs while [ 1 = 1 ] do for f in $(ls .); do $WGETC -q $UPLOAD_URL?$(cat $f) -O - && rm $f done sleep 10 # If there are more than 15 files, assume that files cannot be uploaded # Delete oldest files in order to avoid jffs-overflow ls -t | sed -e '1,15d' | xargs -d '\n' rm 2> /dev/null done