Read_ls_ps = ls_ps.stdout.read().decode('utf-8') Ls_ps = subprocess.Popen('ls %s' %local_mount_folder, shell=True, stdout=subprocess.PIPE)
If re.search('100.0% packet loss',read_ping_ps) is None: Print ('read_ping_ps:\n%s' %read_ping_ps)Ībc = re.search('100.0% packet loss',read_ping_ps) Read_ping_ps = ping_ps.stdout.read().decode('utf-8') Ping_ps = subprocess.Popen('ping -c 3 -m 3 -i 1 %s' %ipnas, shell=True, stdout=subprocess.PIPE) Read_mount_afp_ps = mount_afp_ps.stdout.read().decode('utf-8') Mount_afp_ps = subprocess.Popen('mount_afp -i %s' %(u,p,ipnas,nas_folder_path,local_mount_folder), shell=True, stdout=subprocess.PIPE) If (os.path.exists('/Volumes/%s' %nas_folder_path) is False): Local_mount_folder = os.path.join('/Volumes/'+nas_folder_path) #give some time to connect remote folder where it will sync #mount_afp output cannot be recorded through subprocessįirst_launch_sleep_period = 30 #in seconds