1 #!/bin/sh /etc/rc.common
 
   2 # Copyright (C) 2007-2014 OpenWrt.org
 
   9 PROG=/usr/bin/weathermon
 
  12 BACKUP_DIR=`uci get weathermon.process.backup_dir`
 
  13 BACKLOGDB=`uci get weathermon.process.backlogdb` 
 
  14 LOGDB=`uci get weathermon.process.logdb` 
 
  15 WORK_DIR=`uci get weathermon.process.working_dir`
 
  21         if [ ! -z "$BACKLOGDB" ]; then
 
  23                 sqlite3 $BACKLOGDB "select * from queue limit 1" > /dev/null
 
  25                 if [ "$?" != "0" ]; then
 
  26                         BACKLOG_BASE=$(basename "$BACKLOGDB")
 
  27                         cp "$BACKUP_DIR/$BACKLOG_BASE" "$BACKLOGDB"
 
  32         if [ ! -z "$LOGDB" ]; then
 
  34                 sqlite3 $LOGDB "select * from log limit 1" > /dev/null
 
  36                 if [ "$?" != "0" ]; then
 
  37                         LOG_BASE=$(basename "$LOGDB")
 
  38                         cp "$BACKUP_DIR/$LOG_BASE" "$LOGDB"
 
  44         procd_set_param command "$PROG"
 
  45         procd_set_param nice "$NICEPRIO"
 
  46         procd_set_param respawn
 
  52         killall weathermon-iio
 
  53         /usr/bin/weather-backup