1#!/bin/sh
2config="/bin/config"
3wan_proto="$($config get wan_proto)"
4
5TRAFFIC_STATUS=/tmp/traffic_meter/traffic_meter.conf
6if [ "$wan_proto" = "pppoe" ] || [ "$wan_proto" = "pptp" ] ;then
7	connection_type=0
8else
9	connection_type=1
10fi
11endis_traffic_meter="$($config get endis_traffic)"
12control_type="$($config get ctrl_volumn_time)"
13volume_control_type="$($config get limit)"
14monthly_volume_limit="$($config get mon_volumn_limit)"
15round_up_data="$($config get round_up)"
16monthly_time_limit="$($config get mon_time_limit)" 
17restart_day="$($config get traffic_restart_day)"
18restart_time_hour="$($config get restart_counter_time | awk -F: '{print $1}')"
19restart_time_min="$($config get restart_counter_time | awk -F: '{print $2}')"
20traffic_led="$($config get traffic_led)"
21traffic_block="$($config get traffic_block_all)"
22if [ -f /tmp/traffic_meter/last_conn_time ] ;then
23last_conn_time=`cat /tmp/traffic_meter/last_conn_time | awk -F. '{print $1}'`
24else
25last_conn_time=0
26fi
27if [ -f /tmp/traffic_meter/last_stop_time ] ;then
28last_stop_time=`cat /tmp/traffic_meter/last_stop_time | awk -F. '{print $1}'`
29else
30last_stop_time=0
31fi
32left_volume_time="$($config get left_time_volumn)"
33
34GUI_Region="$($config get GUI_Region)"
35echo "connection_type="$connection_type > $TRAFFIC_STATUS
36echo "endis_traffic_meter="$endis_traffic_meter >> $TRAFFIC_STATUS
37echo "control_type="$control_type >> $TRAFFIC_STATUS
38echo "volume_control_type="$volume_control_type >> $TRAFFIC_STATUS
39echo "monthly_volume_limit="$monthly_volume_limit >> $TRAFFIC_STATUS
40echo "round_up_data="$round_up_data >> $TRAFFIC_STATUS
41echo "monthly_time_limit="$monthly_time_limit >> $TRAFFIC_STATUS
42echo "restart_day="$restart_day >> $TRAFFIC_STATUS
43echo "restart_time_hour="$restart_time_hour >> $TRAFFIC_STATUS
44echo "restart_time_min="$restart_time_min >> $TRAFFIC_STATUS
45echo "traffic_led="$traffic_led >> $TRAFFIC_STATUS
46echo "traffic_block="$traffic_block >> $TRAFFIC_STATUS
47echo "last_conn_time="$last_conn_time >> $TRAFFIC_STATUS
48echo "last_stop_time="$last_stop_time >> $TRAFFIC_STATUS
49echo "left_volume_time="$left_volume_time >> $TRAFFIC_STATUS
50
51# please keep "GUI_Region" in the last line.
52if [ "$GUI_Region" != "German" ]; then
53	region=0
54else
55	region=1
56fi
57echo "GUI_Region="$region >> $TRAFFIC_STATUS
58
59