Use sudo
This commit is contained in:
		
							parent
							
								
									c894805619
								
							
						
					
					
						commit
						866df76336
					
				
					 2 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -40,7 +40,7 @@ smb_active = 0
 | 
				
			||||||
smb_files = 0
 | 
					smb_files = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
    smbd_output = subprocess.check_output(["lsof", "-c", "/^"+SMBD+"$/", "-Pcnt"], stderr=subprocess.DEVNULL).decode()
 | 
					    smbd_output = subprocess.check_output([SUDO, "lsof", "-c", "/^"+SMBD+"$/", "-Pcnt"], stderr=subprocess.DEVNULL).decode()
 | 
				
			||||||
except subprocess.CalledProcessError as e:
 | 
					except subprocess.CalledProcessError as e:
 | 
				
			||||||
    # Error running process.
 | 
					    # Error running process.
 | 
				
			||||||
    pass
 | 
					    pass
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ http_users = 0
 | 
				
			||||||
http_files = 0
 | 
					http_files = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
    http_output = subprocess.check_output(["lsof", "-c", "/^"+APACHE+"$/", "-Pcnt"], stderr=subprocess.DEVNULL).decode()
 | 
					    http_output = subprocess.check_output([SUDO, "lsof", "-c", "/^"+APACHE+"$/", "-Pcnt"], stderr=subprocess.DEVNULL).decode()
 | 
				
			||||||
except subprocess.CalledProcessError as e:
 | 
					except subprocess.CalledProcessError as e:
 | 
				
			||||||
    # Error running process.
 | 
					    # Error running process.
 | 
				
			||||||
    pass
 | 
					    pass
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
SERVER_NAME = "SomeServer"
 | 
					SERVER_NAME = "SomeServer"
 | 
				
			||||||
 | 
					SUDO = "sudo"
 | 
				
			||||||
SMBD = "smbd"
 | 
					SMBD = "smbd"
 | 
				
			||||||
APACHE = "apache2"
 | 
					APACHE = "apache2"
 | 
				
			||||||
BASE_DIR = "/media/share_root"
 | 
					BASE_DIR = "/media/share_root"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue