mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Add interface in vnstat only if enabled in quota
This commit is contained in:
		
							parent
							
								
									dc2d57d960
								
							
						
					
					
						commit
						17670c520e
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -21,16 +21,16 @@ _launch_quota() {
 | 
				
			||||||
	interface=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
 | 
						interface=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[ -z "$interface" ] && return
 | 
						[ -z "$interface" ] && return
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
 | 
						[ -z "$txquota" ] && [ -z "$rxquota" ] && [ -z "$ttquota" ] && return
 | 
				
			||||||
 | 
						[ "$enabled" = "0" ] && return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[ "$(uci get vnstat.@vnstat[-1].interface | grep $interface)" = "" ] && {
 | 
						[ "$(uci get vnstat.@vnstat[-1].interface | grep $interface)" = "" ] && {
 | 
				
			||||||
		uci -q batch <<-EOF
 | 
							uci -q batch <<-EOF
 | 
				
			||||||
			add_list vnstat.@vnstat[-1].interface=$interface
 | 
								add_list vnstat.@vnstat[-1].interface=$interface
 | 
				
			||||||
		EOF
 | 
							EOF
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[ -z "$txquota" ] && [ -z "$rxquota" ] && [ -z "$ttquota" ] && return
 | 
					 | 
				
			||||||
	[ "$enabled" = "0" ] && return
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	procd_open_instance
 | 
						procd_open_instance
 | 
				
			||||||
	procd_set_param command /bin/omr-quota "$interface"
 | 
						procd_set_param command /bin/omr-quota "$interface"
 | 
				
			||||||
	procd_append_param env "OMR_QUOTA_TX=$txquota"
 | 
						procd_append_param env "OMR_QUOTA_TX=$txquota"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue